aboutsummaryrefslogtreecommitdiff
path: root/test/standalone.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2015-11-27 00:40:26 -0700
committerAndrew Kelley <superjoe30@gmail.com>2015-11-27 00:40:26 -0700
commit821907317eb77a96dc53adf20ac705b4501e2ab8 (patch)
tree742da51aa2306895b1605877904d2763402989e2 /test/standalone.cpp
parent4060ae93fb14b333166ff9d8ba880ff128989d31 (diff)
downloadzig-821907317eb77a96dc53adf20ac705b4501e2ab8.tar.gz
zig-821907317eb77a96dc53adf20ac705b4501e2ab8.zip
support C-style comments, plus nesting
Diffstat (limited to 'test/standalone.cpp')
-rw-r--r--test/standalone.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/test/standalone.cpp b/test/standalone.cpp
index e6dbf75186..caeb926a06 100644
--- a/test/standalone.cpp
+++ b/test/standalone.cpp
@@ -75,6 +75,26 @@ static void add_all_test_cases(void) {
exit(0);
}
)SOURCE", "OK\n");
+
+ add_simple_case("comments", R"SOURCE(
+ #link("c")
+ extern {
+ fn puts(s: *mut u8) -> i32;
+ fn exit(code: i32) -> unreachable;
+ }
+
+ /**
+ * multi line doc comment
+ */
+ fn another_function() -> i32 { return 0; }
+
+ /// this is a documentation comment
+ /// doc comment line 2
+ fn _start() -> unreachable {
+ puts(/* mid-line comment /* nested */ */ "OK");
+ exit(0);
+ }
+ )SOURCE", "OK\n");
}
static void run_test(TestCase *test_case) {
@@ -83,11 +103,12 @@ static void run_test(TestCase *test_case) {
Buf zig_stderr = BUF_INIT;
Buf zig_stdout = BUF_INIT;
int return_code;
- os_exec_process("./zig", test_case->compiler_args, &return_code, &zig_stderr, &zig_stdout);
+ static const char *zig_exe = "./zig";
+ os_exec_process(zig_exe, test_case->compiler_args, &return_code, &zig_stderr, &zig_stdout);
if (return_code != 0) {
printf("\nCompile failed with return code %d:\n", return_code);
- printf("zig");
+ printf("%s", zig_exe);
for (int i = 0; i < test_case->compiler_args.length; i += 1) {
printf(" %s", test_case->compiler_args.at(i));
}