Skip to content

Commit

Permalink
Refactor tests for simpler cli for early exits
Browse files Browse the repository at this point in the history
  • Loading branch information
e3m3 committed Sep 20, 2024
1 parent 984f0c0 commit cc2b8ae
Show file tree
Hide file tree
Showing 26 changed files with 104 additions and 91 deletions.
5 changes: 5 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ fn check_options_configuration(options: &RunOptions, output: &OutputType) -> ()
},
};

// If early exit is enabled, don't worry about incompatible output types below
if options.early_exit() {
return;
}

if options.body_type == BodyType::NoMain && options.codegen_type == CodeGenType::Executable {
eprintln!("Unsupported -k-|-no-main with executable output type");
exit(ExitCode::ArgParseError);
Expand Down
4 changes: 4 additions & 0 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ impl RunOptions {
verbose: false,
}
}

pub fn early_exit(&self) -> bool {
self.ir_exit || self.lex_exit || self.parse_exit || self.sem_exit
}
}

impl fmt::Display for RunOptions {
Expand Down
5 changes: 2 additions & 3 deletions tests/lit-tests/irgen1.calc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// RUN: @calcc --no-main -O0 --llvmir -e "with: a,b: a+b + 10" | @filecheck %s
// RUN: @calcc --no-main -O0 -S -e "with: a,b: a+b + 10" | @filecheck %s
// RUN: @calcc --ir -e "with: a,b: a+b + 10" 2>&1 | @filecheck %s
// RUN: @calcc --ir -e "with: a,b: a+b + 10" 2>&1 | @filecheck %s

// CHECK-LABEL: ; ModuleID = 'calcc'
// CHECK: source_filename = "-"

// CHECK-LABEL: define i64 @calcc_main(i64 %0, i64 %1) {
Expand Down
5 changes: 2 additions & 3 deletions tests/lit-tests/irgen2.calc
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// RUN: @calcc --no-main -O0 --llvmir -e "1024*32/8" | @filecheck %s
// RUN: @calcc --no-main -O0 -S -e "1024*32/8" | @filecheck %s
// RUN: @calcc --ir -e "1024*32/8" 2>&1 | @filecheck %s
// RUN: @calcc --ir -e "1024*32/8" 2>&1 | @filecheck %s

/// The comprising arithmetic instructions are being optimized out
/// (constant folding) between insertion in the module and the module dump call.

// CHECK-LABEL: ; ModuleID = 'calcc'
// CHECK: source_filename = "-"

// CHECK-LABEL: define i64 @calcc_main() {
Expand Down
6 changes: 3 additions & 3 deletions tests/lit-tests/lex_comment.calc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: @calcc -v -k -S --lex -e "//" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc -v -k -S --lex -e "// comment" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc -v -k -S --lex -e "with: a: 3/a // Divide by a" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc -v --lex -e "//" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc -v --lex -e "// comment" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc -v --lex -e "with: a: 3/a // Divide by a" 2>&1 | @filecheck %s --check-prefix=CHECK_C

// CHECK_A: Processing input 'Expression://'
// CHECK_A: Read 2 bytes from buffer at line 0
Expand Down
4 changes: 2 additions & 2 deletions tests/lit-tests/lex_drop.calc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: echo -n "hello $" | @calcc --verbose -k -S --lex --drop - 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: echo -n "hello é" | not @calcc --verbose -k -S --lex --drop - 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: echo -n "hello $" | @calcc --verbose --lex --drop - 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: echo -n "hello é" | not @calcc --verbose --lex --drop - 2>&1 | @filecheck %s --check-prefix=CHECK_B

// CHECK_A: Processing input 'Stdin'
// CHECK_A: Read 7 bytes from buffer at line 0
Expand Down
8 changes: 4 additions & 4 deletions tests/lit-tests/lex_hello.calc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// RUN: @calcc --verbose -k -S --lex -e hello 2>&1 | @filecheck %s
// RUN: @calcc --verbose -k -S --lex -e=hello 2>&1 | @filecheck %s
// RUN: @calcc --verbose -k -S --lex --expr hello 2>&1 | @filecheck %s
// RUN: @calcc --verbose -k -S --lex --expr=hello 2>&1 | @filecheck %s
// RUN: @calcc --verbose --lex -e hello 2>&1 | @filecheck %s
// RUN: @calcc --verbose --lex -e=hello 2>&1 | @filecheck %s
// RUN: @calcc --verbose --lex --expr hello 2>&1 | @filecheck %s
// RUN: @calcc --verbose --lex --expr=hello 2>&1 | @filecheck %s

// CHECK: Processing input 'Expression:hello'
// CHECK: Read 5 bytes from buffer at line 0
Expand Down
14 changes: 7 additions & 7 deletions tests/lit-tests/lex_idents.calc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// RUN: @calcc --verbose -k -S --lex -e "N" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose -k -S --lex -e "_N" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose -k -S --lex -e "N0" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose -k -S --lex -e "N_0" 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: @calcc --verbose -k -S --lex -e "_N0" 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: @calcc --verbose -k -S --lex -e "_N_0" 2>&1 | @filecheck %s --check-prefix=CHECK_F
// RUN: @calcc --verbose -k -S --lex -e "-N" 2>&1 | @filecheck %s --check-prefix=CHECK_G
// RUN: @calcc --verbose --lex -e "N" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose --lex -e "_N" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose --lex -e "N0" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose --lex -e "N_0" 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: @calcc --verbose --lex -e "_N0" 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: @calcc --verbose --lex -e "_N_0" 2>&1 | @filecheck %s --check-prefix=CHECK_F
// RUN: @calcc --verbose --lex -e "-N" 2>&1 | @filecheck %s --check-prefix=CHECK_G

// CHECK_A: Processing input 'Expression:N'
// CHECK_A: Read 1 bytes from buffer at line 0
Expand Down
4 changes: 2 additions & 2 deletions tests/lit-tests/lex_nodrop.calc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: echo -n "hello $" | not @calcc --verbose -k -S --lex - 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: echo -n "hello é" | not @calcc --verbose -k -S --lex - 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: echo -n "hello $" | not @calcc --verbose --lex - 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: echo -n "hello é" | not @calcc --verbose --lex - 2>&1 | @filecheck %s --check-prefix=CHECK_B

// CHECK_A: Processing input 'Stdin'
// CHECK_A: Read 7 bytes from buffer at line 0
Expand Down
4 changes: 2 additions & 2 deletions tests/lit-tests/lex_number.calc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: @calcc --verbose --lex -k -S -e 256 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose --lex -k -S -e 10002 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose --lex -e 256 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose --lex -e 10002 2>&1 | @filecheck %s --check-prefix=CHECK_B

// CHECK_A: Processing input 'Expression:256'
// CHECK_A: Read 3 bytes from buffer at line 0
Expand Down
14 changes: 7 additions & 7 deletions tests/lit-tests/lex_number_enhanced.calc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// RUN: @calcc --verbose -k -S --lex -e -9 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose -k -S --lex -e "- 9" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose -k -S --lex -e 0xAF 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose -k -S --lex -e 0x0c1 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: @calcc --verbose -k -S --lex -e 012 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: not @calcc --verbose -k -S --lex -e 0x0z3 2>&1 | @filecheck %s --check-prefix=CHECK_F
// RUN: not @calcc --verbose -k -S --lex -e 140_3 2>&1 | @filecheck %s --check-prefix=CHECK_G
// RUN: @calcc --verbose --lex -e -9 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose --lex -e "- 9" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose --lex -e 0xAF 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose --lex -e 0x0c1 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: @calcc --verbose --lex -e 012 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: not @calcc --verbose --lex -e 0x0z3 2>&1 | @filecheck %s --check-prefix=CHECK_F
// RUN: not @calcc --verbose --lex -e 140_3 2>&1 | @filecheck %s --check-prefix=CHECK_G

// CHECK_A: Processing input 'Expression:-9'
// CHECK_A: Read 2 bytes from buffer at line 0
Expand Down
2 changes: 1 addition & 1 deletion tests/lit-tests/lex_other.calc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: @calcc --verbose --lex -k -S -e ',:-()/*' 2>&1 | @filecheck %s
// RUN: @calcc --verbose --lex -e ',:-()/*' 2>&1 | @filecheck %s

// CHECK: Processing input 'Expression:,:-()/*'
// CHECK: Read 7 bytes from buffer at line 0
Expand Down
2 changes: 1 addition & 1 deletion tests/lit-tests/lex_stdin.calc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: echo -n "hello" | @calcc --verbose -k -S --lex - 2>&1 | @filecheck %s
// RUN: echo -n "hello" | @calcc --verbose --lex - 2>&1 | @filecheck %s

// CHECK: Processing input 'Stdin'
// CHECK: Read 5 bytes from buffer at line 0
Expand Down
4 changes: 2 additions & 2 deletions tests/lit-tests/lex_trailing_whitespace.calc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: @calcc -v --lex -k -S -e "10 + 5 " 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc -v --lex -k -S -e "with: a: 3 + a " 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc -v --lex -e "10 + 5 " 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc -v --lex -e "with: a: 3 + a " 2>&1 | @filecheck %s --check-prefix=CHECK_B

// CHECK_A: Processing input 'Expression:10 + 5 '
// CHECK_A: Read 8 bytes from buffer at line 0
Expand Down
6 changes: 3 additions & 3 deletions tests/lit-tests/lex_withdecl.calc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: @calcc --verbose --lex -k -S -e "with: a,b:a+b" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose --lex -k -S -e "with : a , b: a + b" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose --lex -k -S -e "with: a,b:a*a/b" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose --lex -e "with: a,b:a+b" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose --lex -e "with : a , b: a + b" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose --lex -e "with: a,b:a*a/b" 2>&1 | @filecheck %s --check-prefix=CHECK_C

// CHECK_A: Processing input 'Expression:with: a,b:a+b'
// CHECK_A: Read 13 bytes from buffer at line 0
Expand Down
4 changes: 2 additions & 2 deletions tests/lit-tests/maingen1.calc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: @calcc -O0 --llvmir -e "with: a,b: a+b + 10" | @filecheck %s
// RUN: @calcc -O0 -S -e "with: a,b: a+b + 10" | @filecheck %s
// RUN: @calcc --ir -e "with: a,b: a+b + 10" 2>&1 | @filecheck %s
// RUN: @calcc --ir -e "with: a,b: a+b + 10" 2>&1 | @filecheck %s

// UNSUPPORTED: OS_MACOS

Expand Down
4 changes: 2 additions & 2 deletions tests/lit-tests/maingen2.calc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: @calcc -O0 --llvmir -e "1024*32/8" | @filecheck %s
// RUN: @calcc -O0 -S -e "1024*32/8" | @filecheck %s
// RUN: @calcc --ir -e "1024*32/8" 2>&1 | @filecheck %s
// RUN: @calcc --ir -e "1024*32/8" 2>&1 | @filecheck %s

// UNSUPPORTED: OS_MACOS

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// RUN: not @calcc --llvmir %s --no-main --c-main 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: not @calcc --llvmir %s --c-main --no-main 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: not @calcc %s --no-main --c-main 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: not @calcc %s --c-main --no-main 2>&1 | @filecheck %s --check-prefix=CHECK_A

// RUN: @calcc -v --ir %s --c-main 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc -v --ir %s --c-main 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc -v --ir %s -C 2>&1 | @filecheck %s --check-prefix=CHECK_B

// RUN: @calcc --llvmir %s -O0 --c-main 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --ir %s --c-main 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --ir %s -C 2>&1 | @filecheck %s --check-prefix=CHECK_C

// CHECK_A: Incompatible compiler flags: '-k|--no-main' and '-C|--c-main'

Expand Down Expand Up @@ -53,8 +55,4 @@
// CHECK_C: ret i64 %v6
// CHECK_C: }

// COM: CHECK_C-LABEL: i32 define @main(i32 %vArgc, ptr %vArgv)
// COM: CHECK_C-LABEL: entry:
// COM: CHECK_C: %[[REG0:.+]] = call i64 @calcc_main(i64 %[[REG1:.+]], i64 %[[REG2:.+]])

with: a,b: a*a + 2*b - 3
8 changes: 8 additions & 0 deletions tests/lit-tests/option_c_main2.calc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: not @calcc %s 2>&1 | @filecheck %s

// REQUIRES: OS_MACOS

// CHECK: Linking the C standard library from a kernel+main module is not supported on MacOS
// CHECK: Please use the C-derived main option (-C|--c-main)

with: a,b: a/b
10 changes: 5 additions & 5 deletions tests/lit-tests/parse_eoi.calc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// RUN: not @calcc -v -k -S --parse -e "" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: not @calcc -v -k -S --parse -e "25 + " 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: not @calcc -v -k -S --parse -e "with: a" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: not @calcc -v -k -S --parse -e "with: a: a +" 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: not @calcc -v -k -S --parse -e "// comment" 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: not @calcc -v --parse -e "" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: not @calcc -v --parse -e "25 + " 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: not @calcc -v --parse -e "with: a" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: not @calcc -v --parse -e "with: a: a +" 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: not @calcc -v --parse -e "// comment" 2>&1 | @filecheck %s --check-prefix=CHECK_E

// CHECK_A: Lexed token 'Eoi:'
// CHECK_A: Unexpected token
Expand Down
12 changes: 6 additions & 6 deletions tests/lit-tests/parse_expr_arith.calc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// RUN: @calcc --verbose -k -S --ast --parse -e "32 + 50" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose -k -S --ast --parse -e "32 - 50" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose -k -S --ast --parse -e "32 / 50" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose -k -S --ast --parse -e "32 * 50" 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: @calcc --verbose -k -S --ast --parse -e "32*2/4 + 50/10 - 1" 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: @calcc --verbose -k -S --ast --parse -e "32*-2/4 - 1" 2>&1 | @filecheck %s --check-prefix=CHECK_F
// RUN: @calcc --verbose --ast --parse -e "32 + 50" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose --ast --parse -e "32 - 50" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose --ast --parse -e "32 / 50" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose --ast --parse -e "32 * 50" 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: @calcc --verbose --ast --parse -e "32*2/4 + 50/10 - 1" 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: @calcc --verbose --ast --parse -e "32*-2/4 - 1" 2>&1 | @filecheck %s --check-prefix=CHECK_F

// CHECK_A: Consumed expected token 'Number' at position '0'
// CHECK_A: Consumed expected token 'Plus' at position '1'
Expand Down
14 changes: 7 additions & 7 deletions tests/lit-tests/parse_expr_unary_minus.calc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// RUN: @calcc --verbose -k -S --ast --parse -e "0 - N" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose -k -S --ast --parse -e "-N" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose -k -S --ast --parse -e "-N + 2" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose -k -S --ast --parse -e "2 + -N" 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: @calcc --verbose -k -S --ast --parse -e "-(N) + 2" 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: @calcc --verbose -k -S --ast --parse -e "2 + -(N)" 2>&1 | @filecheck %s --check-prefix=CHECK_F
// RUN: @calcc --verbose -k -S --ast --parse -e "2 + -(N*2)" 2>&1 | @filecheck %s --check-prefix=CHECK_G
// RUN: @calcc --verbose --ast --parse -e "0 - N" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose --ast --parse -e "-N" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose --ast --parse -e "-N + 2" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose --ast --parse -e "2 + -N" 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: @calcc --verbose --ast --parse -e "-(N) + 2" 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: @calcc --verbose --ast --parse -e "2 + -(N)" 2>&1 | @filecheck %s --check-prefix=CHECK_F
// RUN: @calcc --verbose --ast --parse -e "2 + -(N*2)" 2>&1 | @filecheck %s --check-prefix=CHECK_G

// CHECK_A: Consumed expected token 'Number' at position '0'
// CHECK_A: Consumed expected token 'Minus' at position '1'
Expand Down
4 changes: 2 additions & 2 deletions tests/lit-tests/parse_expr_withdecl.calc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// RUN: @calcc --verbose -k -S --ast --parse -e "with: a: 32*a/4 + a/10 - 1" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose -k -S --ast --parse -e "with: a,b: 32*a/b + a/10 - 1" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose --ast --parse -e "with: a: 32*a/4 + a/10 - 1" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose --ast --parse -e "with: a,b: 32*a/b + a/10 - 1" 2>&1 | @filecheck %s --check-prefix=CHECK_B

// CHECK_A: Consumed expected token 'With' at position '0'
// CHECK_A: Consumed expected token 'Colon' at position '1'
Expand Down
10 changes: 5 additions & 5 deletions tests/lit-tests/parse_idents.calc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// RUN: @calcc --verbose -k -S --ast --parse -e a 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose -k -S --ast --parse -e point 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose -k -S --ast --parse -e Zpos 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose -k -S --ast --parse -e __file__ 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: @calcc --verbose -k -S --ast --parse -e tmp002 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: @calcc --verbose --ast --parse -e a 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose --ast --parse -e point 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose --ast --parse -e Zpos 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose --ast --parse -e __file__ 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: @calcc --verbose --ast --parse -e tmp002 2>&1 | @filecheck %s --check-prefix=CHECK_E

// CHECK_A: Consumed expected token 'Ident' at position '0'
// CHECK_A: AST: Ident(a)
Expand Down
18 changes: 9 additions & 9 deletions tests/lit-tests/parse_numbers.calc
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// RUN: @calcc --verbose -k -S --ast --parse -e 256 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose -k -S --ast --parse -e 9 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose -k -S --ast --parse -e -9 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose -k -S --ast --parse -e "- 9" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose -k -S --ast --parse -e "0x7FFFFFFFFFFFFFFF" 2>&1 | @filecheck %s --check-prefix=CHECK_D

// RUN: not @calcc --verbose -k -S --parse -e "0x8000000000000000" 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: not @calcc --verbose -k -S --parse -e "9223372036854775808" 2>&1 | @filecheck %s --check-prefix=CHECK_F
// RUN: not @calcc --verbose -k -S --parse -e "-9223372036854775809" 2>&1 | @filecheck %s --check-prefix=CHECK_G
// RUN: @calcc --verbose --ast --parse -e 256 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose --ast --parse -e 9 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: @calcc --verbose --ast --parse -e -9 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose --ast --parse -e "- 9" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: @calcc --verbose --ast --parse -e "0x7FFFFFFFFFFFFFFF" 2>&1 | @filecheck %s --check-prefix=CHECK_D

// RUN: not @calcc --verbose --parse -e "0x8000000000000000" 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: not @calcc --verbose --parse -e "9223372036854775808" 2>&1 | @filecheck %s --check-prefix=CHECK_F
// RUN: not @calcc --verbose --parse -e "-9223372036854775809" 2>&1 | @filecheck %s --check-prefix=CHECK_G

// CHECK_A: Consumed expected token 'Number' at position '0'
// CHECK_A: AST: 256
Expand Down
10 changes: 5 additions & 5 deletions tests/lit-tests/sem_decl.calc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// RUN: @calcc --verbose -k -S --sem -e "with: a,b: 2*a + b" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose -k -S --sem -e "with: a,b: b + 2*a" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: not @calcc --verbose -k -S --sem -e "with: a: 2*a + b" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: not @calcc --verbose -k -S --sem -e "with: b: 2*a + b" 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: not @calcc --verbose -k -S --sem -e "with: b,b: 2*b + b" 2>&1 | @filecheck %s --check-prefix=CHECK_E
// RUN: @calcc --verbose --sem -e "with: a,b: 2*a + b" 2>&1 | @filecheck %s --check-prefix=CHECK_A
// RUN: @calcc --verbose --sem -e "with: a,b: b + 2*a" 2>&1 | @filecheck %s --check-prefix=CHECK_B
// RUN: not @calcc --verbose --sem -e "with: a: 2*a + b" 2>&1 | @filecheck %s --check-prefix=CHECK_C
// RUN: not @calcc --verbose --sem -e "with: b: 2*a + b" 2>&1 | @filecheck %s --check-prefix=CHECK_D
// RUN: not @calcc --verbose --sem -e "with: b,b: 2*b + b" 2>&1 | @filecheck %s --check-prefix=CHECK_E

// CHECK_A: Added var 'a' to scope
// CHECK_A: Added var 'b' to scope
Expand Down

0 comments on commit cc2b8ae

Please sign in to comment.