forked from extern/nushell
Fix typos and capitalization of "Unicode" (#3234)
* Capitalize "Unicode" * Fix several typos * Fix mixed whitespace in nu-parser's tests
This commit is contained in:
@ -132,11 +132,11 @@ def e [] {echo hi}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn def_comment_with_sinqle_quote() {
|
||||
fn def_comment_with_single_quote() {
|
||||
let input = r#"def f [] {
|
||||
# shouldn't return error
|
||||
echo hi
|
||||
}"#;
|
||||
# shouldn't return error
|
||||
echo hi
|
||||
}"#;
|
||||
let (_result, err) = lex(input, 0);
|
||||
assert!(err.is_none());
|
||||
}
|
||||
@ -144,29 +144,29 @@ def e [] {echo hi}
|
||||
#[test]
|
||||
fn def_comment_with_double_quote() {
|
||||
let input = r#"def f [] {
|
||||
# should "not return error
|
||||
echo hi
|
||||
}"#;
|
||||
# should "not return error
|
||||
echo hi
|
||||
}"#;
|
||||
let (_result, err) = lex(input, 0);
|
||||
assert!(err.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn def_comment_with_bracks() {
|
||||
fn def_comment_with_bracket() {
|
||||
let input = r#"def f [] {
|
||||
# should not [return error
|
||||
echo hi
|
||||
}"#;
|
||||
# should not [return error
|
||||
echo hi
|
||||
}"#;
|
||||
let (_result, err) = lex(input, 0);
|
||||
assert!(err.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn def_comment_with_curly() {
|
||||
fn def_comment_with_curly_brace() {
|
||||
let input = r#"def f [] {
|
||||
# should not return {error
|
||||
echo hi
|
||||
}"#;
|
||||
# should not return {error
|
||||
echo hi
|
||||
}"#;
|
||||
let (_result, err) = lex(input, 0);
|
||||
assert!(err.is_none());
|
||||
}
|
||||
@ -334,7 +334,7 @@ echo 42
|
||||
#[test]
|
||||
fn no_discarded_white_space_start_of_comment() {
|
||||
let code = r#"
|
||||
#No white_space at firt line ==> No white_space discarded
|
||||
#No white_space at first line ==> No white_space discarded
|
||||
# Starting space is not discarded
|
||||
echo 42
|
||||
"#;
|
||||
@ -351,14 +351,14 @@ echo 42
|
||||
result.block[0].pipelines[0].commands[0].comments,
|
||||
Some(vec![
|
||||
LiteComment::new(
|
||||
"No white_space at firt line ==> No white_space discarded"
|
||||
"No white_space at first line ==> No white_space discarded"
|
||||
.to_string()
|
||||
.spanned(Span::new(2, 58))
|
||||
.spanned(Span::new(2, 59))
|
||||
),
|
||||
LiteComment::new(
|
||||
" Starting space is not discarded"
|
||||
.to_string()
|
||||
.spanned(Span::new(60, 94))
|
||||
.spanned(Span::new(61, 95))
|
||||
),
|
||||
])
|
||||
);
|
||||
|
@ -62,8 +62,8 @@ pub fn parse_simple_column_path(
|
||||
output.push(Member::Bare(trimmed.clone().spanned(part_span)));
|
||||
}
|
||||
current_part.clear();
|
||||
// Note: I believe this is safe because of the delimiter we're using, but if we get fancy with
|
||||
// unicode we'll need to change this
|
||||
// Note: I believe this is safe because of the delimiter we're using,
|
||||
// but if we get fancy with Unicode we'll need to change this.
|
||||
start_index = idx + '.'.len_utf8();
|
||||
continue;
|
||||
}
|
||||
@ -143,8 +143,8 @@ pub fn parse_full_column_path(
|
||||
);
|
||||
}
|
||||
current_part.clear();
|
||||
// Note: I believe this is safe because of the delimiter we're using, but if we get fancy with
|
||||
// unicode we'll need to change this
|
||||
// Note: I believe this is safe because of the delimiter we're using,
|
||||
// but if we get fancy with Unicode we'll need to change this.
|
||||
start_index = idx + '.'.len_utf8();
|
||||
continue;
|
||||
}
|
||||
|
@ -311,11 +311,11 @@ fn parse_signature_item_end(tokens: &[Token]) -> (Option<String>, usize, Option<
|
||||
);
|
||||
////Separating flags/parameters is optional.
|
||||
////If this should change, the below code would raise a warning whenever 2 parameters/flags are
|
||||
////not delmited by <,> or <eol>
|
||||
////not delimited by <,> or <eol>
|
||||
//if there is next item, but it's not comma, then it must be Optional(#Comment) + <eof>
|
||||
//let parsed_delimiter = parsed_comma || parsed_eol;
|
||||
//if !parsed_delimiter && i < tokens.len() {
|
||||
// //If not parsed , or eol but more tokens are comming
|
||||
// //If not parsed , or eol but more tokens are coming
|
||||
// err = err.or(Some(ParseError::mismatch(
|
||||
// "Newline or ','",
|
||||
// (token[i-1].to_string() + token[i].to_string()).spanned(token[i-1].span.until(token[i].span))
|
||||
|
Reference in New Issue
Block a user