MCPcopy Create free account
hub / github.com/PRQL/prql / test_error_unicode_string

Function test_error_unicode_string

prqlc/prqlc-parser/src/test.rs:59–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57
58#[test]
59fn test_error_unicode_string() {
60 // Test various unicode strings successfully parse errors. We were
61 // getting loops in the lexer before.
62 parse_source("s’ ").unwrap_err();
63 parse_source("s’").unwrap_err();
64 parse_source(" s’").unwrap_err();
65 parse_source(" ’ s").unwrap_err();
66 parse_source("’s").unwrap_err();
67 parse_source("👍 s’").unwrap_err();
68
69 let source = "Mississippi has four S’s and four I’s.";
70
71 // LEXER output for comparison (what the lexer sees):
72 assert_debug_snapshot!(crate::lexer::lex_source(source).unwrap_err(), @r#"
73 [
74 Error {
75 kind: Error,
76 span: Some(
77 0:22-23,
78 ),
79 reason: Unexpected {
80 found: "'’'",
81 },
82 hints: [],
83 code: None,
84 },
85 ]
86 "#);
87
88 // PARSER output (what happens after lexing):
89 assert_debug_snapshot!(parse_source(source).unwrap_err(), @r#"
90 [
91 Error {
92 kind: Error,
93 span: Some(
94 0:22-23,
95 ),
96 reason: Unexpected {
97 found: "'’'",
98 },
99 hints: [],
100 code: None,
101 },
102 ]
103 "#);
104}
105
106#[test]
107fn test_error_unexpected() {

Callers

nothing calls this directly

Calls 1

parse_sourceFunction · 0.70

Tested by

no test coverage detected