diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-04-24 02:15:32 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-23 23:15:32 -0700 |
| commit | 697017e6fae8c252638abc298ec1556de2e41314 (patch) | |
| tree | 6278e3773e02124b3d140e42f74a6934049c7751 /tests/bugs | |
| parent | d1b0d5acb22cf8b6258b40c8690cd0c7e3989d3e (diff) | |
Fix lexer/preproc diagnose issue (#1806)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Pass LexerFlags to all lexing functionality that may output a diagnostic.
* Add test for lexing disabling issue.
* Improve tests.
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/bugs')
| -rw-r--r-- | tests/bugs/preproc-lex-failure-2.slang | 12 | ||||
| -rw-r--r-- | tests/bugs/preproc-lex-failure-2.slang.expected | 12 | ||||
| -rw-r--r-- | tests/bugs/preproc-lex-failure.slang | 12 | ||||
| -rw-r--r-- | tests/bugs/preproc-lex-failure.slang.expected | 6 |
4 files changed, 42 insertions, 0 deletions
diff --git a/tests/bugs/preproc-lex-failure-2.slang b/tests/bugs/preproc-lex-failure-2.slang new file mode 100644 index 000000000..a3caf1634 --- /dev/null +++ b/tests/bugs/preproc-lex-failure-2.slang @@ -0,0 +1,12 @@ +//DIAGNOSTIC_TEST:SIMPLE:-E + +// Test that diagnostics appear for invalid tokens. + +#if 1 +// Octal warning +000 +/// Unclosed string literal +"Hello! +#else +Hello +#endif diff --git a/tests/bugs/preproc-lex-failure-2.slang.expected b/tests/bugs/preproc-lex-failure-2.slang.expected new file mode 100644 index 000000000..8365e74e8 --- /dev/null +++ b/tests/bugs/preproc-lex-failure-2.slang.expected @@ -0,0 +1,12 @@ +result code = 0 +standard error = { +tests/bugs/preproc-lex-failure-2.slang(4): warning 10002: '0' prefix indicates octal literal +000 +^~~ +tests/bugs/preproc-lex-failure-2.slang(5): error 10005: newline in literal + +^ +} +standard output = { +000 "Hello! +} diff --git a/tests/bugs/preproc-lex-failure.slang b/tests/bugs/preproc-lex-failure.slang new file mode 100644 index 000000000..42c807ae2 --- /dev/null +++ b/tests/bugs/preproc-lex-failure.slang @@ -0,0 +1,12 @@ +//DIAGNOSTIC_TEST:SIMPLE:-E + +#if 0 +// Octal warning +000 +/// Unclosed string literal +"Hello! +/// A non 7 bit ascii code +Š +#else +Hello +#endif
\ No newline at end of file diff --git a/tests/bugs/preproc-lex-failure.slang.expected b/tests/bugs/preproc-lex-failure.slang.expected new file mode 100644 index 000000000..e4505eb4f --- /dev/null +++ b/tests/bugs/preproc-lex-failure.slang.expected @@ -0,0 +1,6 @@ +result code = 0 +standard error = { +} +standard output = { +Hello +} |
