Fix Windows doc comments (#4643)

* WIP windows doc comments

* WIP windows doc comments

* WIP windows doc comments

* actual fix this time
This commit is contained in:
JT 2022-02-25 13:03:39 -05:00 committed by GitHub
parent e6570b41ca
commit 977ef66356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 1 deletions

View File

@ -32,3 +32,34 @@ fn use_module_file_within_block() {
assert_eq!(actual.out, "hello world"); assert_eq!(actual.out, "hello world");
}) })
} }
#[test]
fn use_keeps_doc_comments() {
Playground::setup("use_doc_comments", |dirs, nu| {
let file = AbsolutePath::new(dirs.test().join("spam.nu"));
nu.with_files(vec![FileWithContent(
&file.display_path(),
r#"
# this is my foo command
export def foo [
x:string # this is an x parameter
] {
echo "hello world"
}
"#,
)]);
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
use spam.nu foo;
help foo
"#
)
);
assert!(actual.out.contains("this is my foo command"));
assert!(actual.out.contains("this is an x parameter"));
})
}

View File

@ -276,7 +276,7 @@ pub fn lex(
let mut start = curr_offset; let mut start = curr_offset;
while let Some(input) = input.get(curr_offset) { while let Some(input) = input.get(curr_offset) {
if *input == b'\n' || *input == b'\r' { if *input == b'\n' {
if !skip_comment { if !skip_comment {
output.push(Token::new( output.push(Token::new(
TokenContents::Comment, TokenContents::Comment,