mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
155934f783
# Description Fixes: #12795 The issue is caused by an empty position of `ParseError::UnexpectedEof`. So no detailed message is displayed. To fix the issue, I adjust the start of span to `span.end - 1`. In this way, we can make sure that it never points to an empty position. After lexing item, I also reorder the unclosed character checking . Now it will be checking unclosed opening delimiters first. # User-Facing Changes After this pr, it outputs detailed error message for incomplete string when running scripts. ## Before ``` ❯ nu -c "'ab" Error: nu::parser::unexpected_eof × Unexpected end of code. ╭─[source:1:4] 1 │ 'ab ╰──── > ./target/debug/nu -c "r#'ab" Error: nu::parser::unexpected_eof × Unexpected end of code. ╭─[source:1:6] 1 │ r#'ab ╰──── ``` ## After ``` > nu -c "'ab" Error: nu::parser::unexpected_eof × Unexpected end of code. ╭─[source:1:3] 1 │ 'ab · ┬ · ╰── expected closing ' ╰──── > ./target/debug/nu -c "r#'ab" Error: nu::parser::unexpected_eof × Unexpected end of code. ╭─[source:1:5] 1 │ r#'ab · ┬ · ╰── expected closing '# ╰──── ``` # Tests + Formatting Added some tests for incomplete string. --------- Co-authored-by: Ian Manske <ian.manske@pm.me> |
||
---|---|---|
.. | ||
mod.rs | ||
test_bits.rs | ||
test_cell_path.rs | ||
test_commandline.rs | ||
test_conditionals.rs | ||
test_config.rs | ||
test_config_path.rs | ||
test_converters.rs | ||
test_custom_commands.rs | ||
test_engine.rs | ||
test_env.rs | ||
test_help.rs | ||
test_hiding.rs | ||
test_ide.rs | ||
test_iteration.rs | ||
test_known_external.rs | ||
test_math.rs | ||
test_modules.rs | ||
test_parser.rs | ||
test_ranges.rs | ||
test_regex.rs | ||
test_signatures.rs | ||
test_spread.rs | ||
test_stdlib.rs | ||
test_strings.rs | ||
test_table_operations.rs | ||
test_type_check.rs | ||
tests.rs |