Skip to content

Commit

Permalink
merge nightly-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em committed Apr 30, 2024
2 parents 4d2ed60 + f6a8ce3 commit 4d65e92
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lean-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
leanprover/lean4:nightly-2024-03-16
leanprover/lean4:nightly-2024-04-30
25 changes: 21 additions & 4 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

lake build

trim() {
local var="$*"
# Remove all leading whitespace and newline characters
while [[ $var =~ ^[[:space:]] ]]; do
var="${var#?}" # Remove the first character repeatedly if it's whitespace
done
# Remove all trailing whitespace and newline characters
while [[ $var =~ [[:space:]]$ ]]; do
var="${var%?}" # Remove the last character repeatedly if it's whitespace
done
printf '%s' "$var"
}

check_command() {
local cmd="$1"
local expected="$2"
Expand All @@ -13,6 +26,10 @@ check_command() {
exit 1
fi

# Account for weird whitespace from lake
# https://leanprover.zulipchat.com/#narrow/stream/428973-nightly-testing/topic/Mathlib.20status.20updates/near/436249454
output=$(trim "$output")

if [[ "$output" != "$expected" ]]; then
echo "Error: The command '$cmd' did not produce the expected error."
echo "Expected:"
Expand All @@ -23,19 +40,19 @@ check_command() {
fi
}

check_command "lake exe lean4checker Lean4CheckerTests.AddFalse" "uncaught exception: (kernel) declaration type mismatch, 'false' has type
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 exe lean4checker Lean4CheckerTests.AddFalseConstructor" "uncaught exception: No such constructor False.intro"
check_command "lake -q exe lean4checker Lean4CheckerTests.AddFalseConstructor" "uncaught exception: No such constructor False.intro"

check_command "lake exe lean4checker --fresh Lean4CheckerTests.UseFalseConstructor" "uncaught exception: (kernel) unknown constant '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 exe lean4checker Lean4CheckerTests.ReduceBool" "uncaught exception: (kernel) unknown declaration 'foo'"
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."

0 comments on commit 4d65e92

Please sign in to comment.