forked from extern/nushell
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:
parent
e6570b41ca
commit
977ef66356
@ -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"));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user