diff options
| author | Yong He <yonghe@outlook.com> | 2022-09-20 14:51:11 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-20 14:51:11 -0700 |
| commit | e60a6fd40cbc0f0d8548f0160bb92437e3d79509 (patch) | |
| tree | 7957ea8939a8335509a06ee9c2b9c4baa45bda64 /tests/front-end | |
| parent | 5ac7ba2c6d3405f1a59f4350c753ec990af8f6dc (diff) | |
Support raw string literals. (#2405)
* Support raw string literals.
* Use raw string literal in tests.
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tests/front-end')
| -rw-r--r-- | tests/front-end/raw-string-literal.slang | 28 | ||||
| -rw-r--r-- | tests/front-end/raw-string-literal.slang.expected | 8 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/front-end/raw-string-literal.slang b/tests/front-end/raw-string-literal.slang new file mode 100644 index 000000000..321f183c7 --- /dev/null +++ b/tests/front-end/raw-string-literal.slang @@ -0,0 +1,28 @@ +// Test raw string literals. + +//TEST:EXECUTABLE: +__target_intrinsic(cpp, R"delim(printf("%c", $0))delim") +void writeChar(int8_t ch); + +void printLines(NativeString text) +{ + NativeString str = text; + int8_t *ptr = bit_cast<Ptr<int8_t>>(str); + for (int i = 0; i < text.length; i++) + { + if (ptr[i] != 13) + { + writeChar(ptr[i]); + } + } +} + +public __extern_cpp int main() +{ + printLines( + R"(This is line 1. + This is line 2. + "Hello World" + )"); + return 0; +}
\ No newline at end of file diff --git a/tests/front-end/raw-string-literal.slang.expected b/tests/front-end/raw-string-literal.slang.expected new file mode 100644 index 000000000..684398fb1 --- /dev/null +++ b/tests/front-end/raw-string-literal.slang.expected @@ -0,0 +1,8 @@ +result code = 0 +standard error = { +} +standard output = { +This is line 1. + This is line 2. + "Hello World" + } |
