simple errors for lang-dev
| -rw-r--r-- | .github/example.png | bin | 4547 -> 14014 bytes | |||
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | src/lib.rs | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/.github/example.png b/.github/example.png Binary files differindex fdf6cb9..0b48e46 100644 --- a/.github/example.png +++ b/.github/example.png @@ -18,8 +18,8 @@ e.label((0..5, "you probably meant String")) .label((30..37, "your π is bad")); eprintln!("{e}"); // dont mind this -assert_eq!(e.to_string(), "\n\u{1b}[1;34;30m0 │ \u{1b}[0mStrin::nouveau().i_like_tests(3.14158)\n\u{1b}[1;34;30m ¦ \u{1b}[0m\u{1b}[1;34;31m──┬──\u{1b}[0m \u{1b}[1;34;31m────┬────\u{1b}[0m \u{1b}[1;34;31m^\u{1b}[0m caps: I \u{1b}[1;34;31m^^^^^^^\u{1b}[0m your π is bad\n\u{1b}[1;34;30m ¦ \u{1b}[0m \u{1b}[1;34;31m│\u{1b}[0m \u{1b}[1;34;31m╰\u{1b}[0m use new()\n\u{1b}[1;34;30m ¦ \u{1b}[0m \u{1b}[1;34;31m╰\u{1b}[0m you probably meant String\n"); +assert_eq!(e.to_string(), "\n\u{1b}[1;34;30m0 | \u{1b}[0mStrin::nouveau().i_like_tests(3.14158)\n\u{1b}[1;34;30m ¦ \u{1b}[0m\u{1b}[1;34;31m──┬──\u{1b}[0m \u{1b}[1;34;31m────┬────\u{1b}[0m \u{1b}[1;34;31m^\u{1b}[0m caps: I \u{1b}[1;34;31m^^^^^^^\u{1b}[0m your π is bad\n\u{1b}[1;34;30m ¦ \u{1b}[0m \u{1b}[1;34;31m│\u{1b}[0m \u{1b}[1;34;31m╰\u{1b}[0m use new()\n\u{1b}[1;34;30m ¦ \u{1b}[0m \u{1b}[1;34;31m╰\u{1b}[0m you probably meant String\n"); ``` Please note that multiline labels are not yet supported. -If that doesnt work for you, use something like [ariadne](https://crates.io/crates/ariadne).
\ No newline at end of file +If that doesnt work for you, use something like [ariadne](https://crates.io/crates/ariadne). @@ -150,7 +150,7 @@ impl<'s> std::fmt::Display for Error<'s> { if found.is_empty() { continue; } - writeln!(f, "\x1b[1;34;30m{line:width$} │ \x1b[0m{code}")?; + writeln!(f, "\x1b[1;34;30m{line:width$} | \x1b[0m{code}")?; write!(f, "\x1b[1;34;30m{space:width$} ¦ \x1b[0m")?; // sort by width @@ -258,7 +258,7 @@ fn display() { .note("\x1b[1;34;34mnote\x1b[0m: maybe python would be better for you") .to_string(); println!("{out}"); - assert_eq!(out, "\n\u{1b}[1;34;30m0 │ \u{1b}[0mvoid fn x(void) -> four {\n\u{1b}[1;34;30m ¦ \u{1b}[0m \u{1b}[1;34;31m^^^^\u{1b}[0m what is 'four'?\n \u{1b}[1;34;30m>\u{1b}[0m \u{1b}[1;34;32mhelp\u{1b}[0m: change it to 4\n \u{1b}[1;34;30m>\u{1b}[0m \u{1b}[1;34;34mnote\u{1b}[0m: maybe python would be better for you\n"); + assert_eq!(out, "\n\u{1b}[1;34;30m0 | \u{1b}[0mvoid fn x(void) -> four {\n\u{1b}[1;34;30m ¦ \u{1b}[0m \u{1b}[1;34;31m^^^^\u{1b}[0m what is 'four'?\n \u{1b}[1;34;30m>\u{1b}[0m \u{1b}[1;34;32mhelp\u{1b}[0m: change it to 4\n \u{1b}[1;34;30m>\u{1b}[0m \u{1b}[1;34;34mnote\u{1b}[0m: maybe python would be better for you\n"); } #[test] fn inline() { @@ -267,5 +267,5 @@ fn inline() { .label((0..2, r#"forgot '"#)) .to_string(); println!("{out}"); - assert_eq!(out, "\n\u{1b}[1;34;30m0 │ \u{1b}[0mim out of this worl\n\u{1b}[1;34;30m ¦ \u{1b}[0m\u{1b}[1;34;31m^^\u{1b}[0m forgot ' \u{1b}[1;34;31m^^^^\u{1b}[0m forgot d\n"); + assert_eq!(out, "\n\u{1b}[1;34;30m0 | \u{1b}[0mim out of this worl\n\u{1b}[1;34;30m ¦ \u{1b}[0m\u{1b}[1;34;31m^^\u{1b}[0m forgot ' \u{1b}[1;34;31m^^^^\u{1b}[0m forgot d\n"); } |