Skip to content

Commit

Permalink
[Driver] added driver tests
Browse files Browse the repository at this point in the history
  • Loading branch information
isuckatcs committed Jun 30, 2024
1 parent b9ddec9 commit 18a9a92
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/driver/help.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: compiler -h 2>&1 | filecheck %s

// CHECK: Usage:
// CHECK-NEXT: your-compiler [options] <source_file>
// CHECK-NEXT:
// CHECK-NEXT: Options:
// CHECK-NEXT: -h display this message
// CHECK-NEXT: -o <file> write executable to <file>
// CHECK-NEXT: -ast-dump print the abstract syntax tree
// CHECK-NEXT: -res-dump print the resolved syntax tree
// CHECK-NEXT: -llvm-dump print the llvm module
// CHECK-NEXT: -cfg-dump print the control flow graph
2 changes: 2 additions & 0 deletions test/driver/multiple_sources.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// RUN: (compiler src1 src2 || true) 2>&1 | filecheck %s
// CHECK: error: unexpected argument 'src2'
2 changes: 2 additions & 0 deletions test/driver/no_source.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// RUN: (compiler || true) 2>&1 | filecheck %s
// CHECK: error: no source file specified
2 changes: 2 additions & 0 deletions test/driver/non_existent_source.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// RUN: (compiler ./non_existent_source || true) 2>&1 | filecheck %s
// CHECK: error: failed to open './non_existent_source'
2 changes: 2 additions & 0 deletions test/driver/parser_error_retcode.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// RUN: compiler %s || test $? -eq 1
parser error
2 changes: 2 additions & 0 deletions test/driver/sema_error_retcode copy.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// RUN: compiler %s || test $? -eq 1
fn main(): semaError {}
2 changes: 2 additions & 0 deletions test/driver/unknown_option.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// RUN: (compiler -unknown || true) 2>&1 | filecheck %s
// CHECK: error: unexpected option '-unknown'

0 comments on commit 18a9a92

Please sign in to comment.