From c9ad518d5261bb322699bba7fa5f503787b52b6b Mon Sep 17 00:00:00 2001 From: Alex Cole Date: Thu, 19 Nov 2020 01:21:57 +0100 Subject: [PATCH] Add multiline string length tests. --- .../tests/multiline_string_sizes.meta | 5 ++++ .../compiler/tests/multiline_string_sizes.pwn | 23 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 source/compiler/tests/multiline_string_sizes.meta create mode 100644 source/compiler/tests/multiline_string_sizes.pwn diff --git a/source/compiler/tests/multiline_string_sizes.meta b/source/compiler/tests/multiline_string_sizes.meta new file mode 100644 index 0000000..bfdf252 --- /dev/null +++ b/source/compiler/tests/multiline_string_sizes.meta @@ -0,0 +1,5 @@ +{ + 'test_type': 'output_check', + 'errors': """ + """ +} diff --git a/source/compiler/tests/multiline_string_sizes.pwn b/source/compiler/tests/multiline_string_sizes.pwn new file mode 100644 index 0000000..6010f3d --- /dev/null +++ b/source/compiler/tests/multiline_string_sizes.pwn @@ -0,0 +1,23 @@ +// This file should pass with \r\n and \n. + +new str1[] = "hello"; +#assert sizeof(str1) == 6 + +new str2[] = "hello\ +"; +#assert sizeof(str2) == 6 + +new str3[] = "hello\ + "; +#assert sizeof(str3) == 6 + +new str4[] = "hello\ + world"; +#assert sizeof(str4) == 11 + +new str5[] = "hello + world"; +#assert sizeof(str5) == 23 + +#pragma unused str1, str2, str3, str4, str5 +