| 1 |
""" |
| 2 |
Tests of the theorem lexers |
| 3 |
""" |
| 4 |
|
| 5 |
import textwrap |
| 6 |
|
| 7 |
from pygments.lexers.lean import Lean3Lexer, Lean4Lexer |
| 8 |
|
| 9 |
def test_lean3_import(): |
| 10 |
s = textwrap.dedent("""\ |
| 11 |
-- this is Lean 3 |
| 12 |
import data.nat.basic |
| 13 |
|
| 14 |
def foo : nat := 1 |
| 15 |
""") |
| 16 |
assert Lean3Lexer.analyse_text(s) > 0 |
| 17 |
assert Lean4Lexer.analyse_text(s) == 0 |
| 18 |
|
| 19 |
def test_lean4_import(): |
| 20 |
s = textwrap.dedent("""\ |
| 21 |
-- this is Lean 4 |
| 22 |
import Mathlib.Data.Nat.Basic |
| 23 |
|
| 24 |
def foo : Nat := 1 |
| 25 |
""") |
| 26 |
assert Lean3Lexer.analyse_text(s) == 0 |
| 27 |
assert Lean4Lexer.analyse_text(s) > 0 |