Skip to content

Commit

Permalink
fix test framework and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em committed Nov 16, 2023
1 parent 19207d2 commit ffa7217
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
on:
push:
pull_request:

name: continuous integration

Expand Down
4 changes: 0 additions & 4 deletions Lean4Checker.lean
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
import Lean4Checker.Tests.AddFalse
import Lean4Checker.Tests.AddFalseConstructor
import Lean4Checker.Tests.ReduceBool
import Lean4Checker.Tests.UseFalseConstructor
Empty file added Lean4CheckerTests.lean
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Lean4Checker.Tests.OpenPrivate
import Lean4CheckerTests.OpenPrivate

open private mk from Lean.Environment

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Lean4Checker.Tests.OpenPrivate
import Lean4CheckerTests.OpenPrivate

open private mk from Lean.Environment

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Lean4Checker.Tests.AddFalseConstructor
import Lean4CheckerTests.AddFalseConstructor

theorem useEvilConstructor : False :=
False.intro
7 changes: 6 additions & 1 deletion lakefile.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ open Lake DSL

package «lean4checker» where

@[default_target]
@[default_target]
lean_lib «Lean4Checker» where
globs := #[.andSubmodules `Lean4Checker]

@[default_target]
lean_exe «lean4checker» where
root := `Main
supportInterpreter := true

@[default_target]
lean_lib «Lean4CheckerTests» where
globs := #[.andSubmodules `Lean4CheckerTests]
18 changes: 8 additions & 10 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/bash
#!/usr/bin/env bash

# Because `Lean4Checker/Tests/ReduceBool.lean` is non-deterministic (compiles only 1/4 of the time),
# we just keep rebuilding until it works!
until lake build > /dev/null 2>&1; do :; done
lake build

check_command() {
local cmd="$1"
Expand All @@ -25,19 +23,19 @@ check_command() {
fi
}

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

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

check_command "lake 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 ffa7217

Please sign in to comment.