-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.sh
executable file
·41 lines (31 loc) · 1.3 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
lake build
check_command() {
local cmd="$1"
local expected="$2"
output=$($cmd 2>&1)
if [ $? -eq 0 ]; then
echo "Error: The command '$cmd' succeeded but was expected to fail."
exit 1
fi
if [[ "$output" != "$expected" ]]; then
echo "Error: The command '$cmd' did not produce the expected error."
echo "Expected:"
echo "$expected"
echo "Got:"
echo "$output"
exit 1
fi
}
check_command "lake -q exe lean4checker Lean4CheckerTests.AddFalse" "uncaught exception: (kernel) declaration type mismatch, 'false' has type
Prop
but it is expected to have type
False"
check_command "lake -q exe lean4checker Lean4CheckerTests.AddFalseConstructor" "uncaught exception: No such constructor False.intro"
check_command "lake -q exe lean4checker --fresh Lean4CheckerTests.UseFalseConstructor" "uncaught exception: (kernel) unknown constant 'False.intro'"
# The 'ReduceBool' test writes to a temporary file.
# We clean up before and afterwards for consistency, although neither should be required.
rm -f .lean4checker.tmp
check_command "lake -q exe lean4checker Lean4CheckerTests.ReduceBool" "uncaught exception: (kernel) unknown declaration 'foo'"
rm -f .lean4checker.tmp
echo "All commands produced the expected errors."