This PR sets up the new integrated test/bench suite. It then migrates all benchmarks and some related tests to the new suite. There's also some documentation and some linting. For now, a lot of the old tests are left alone so this PR doesn't become even larger than it already is. Eventually, all tests should be migrated to the new suite though so there isn't a confusing mix of two systems.
70 lines
1.4 KiB
Text
70 lines
1.4 KiB
Text
import Lean.Elab.BuiltinCommand
|
|
|
|
open Lean.Elab.Command
|
|
open Lean
|
|
|
|
namespace Something
|
|
|
|
namespace MyNamespace
|
|
|
|
local elab "end" id:ident : command => do
|
|
println!"foo"
|
|
let node := mkNode ``Lean.Parser.Command.end
|
|
#[Lean.mkAtom "end", mkNullNode #[id, mkOptionalNode none]]
|
|
elabEnd node
|
|
|
|
end MyNamespace -- print "foo"
|
|
|
|
end Something -- nothing
|
|
|
|
namespace Something
|
|
|
|
namespace MyNamespace
|
|
|
|
@[local command_elab Lean.Parser.Command.end] def elabEnd' : CommandElab := fun stx =>
|
|
match stx with
|
|
| `(end $id:ident) => do
|
|
println!"boo"
|
|
let node := mkNode ``Lean.Parser.Command.end
|
|
#[Lean.mkAtom "end", mkOptionalNode id]
|
|
elabEnd node
|
|
| _ => Elab.throwUnsupportedSyntax
|
|
|
|
end MyNamespace -- print "boo"
|
|
|
|
end Something -- print nothing as expected
|
|
|
|
namespace Something'
|
|
|
|
namespace MyNamespace
|
|
|
|
local elab_rules : command
|
|
| `(end $id:ident) => do
|
|
println!"hello"
|
|
let node := mkNode ``Lean.Parser.Command.end
|
|
#[Lean.mkAtom "end", mkOptionalNode id]
|
|
elabEnd node
|
|
|
|
end MyNamespace -- print "hello"
|
|
|
|
end Something' -- print nothing as expected
|
|
|
|
namespace Something''
|
|
|
|
namespace MyNamespace
|
|
|
|
scoped elab_rules : command
|
|
| `(end $id:ident) => do
|
|
println!"bla"
|
|
let node := mkNode ``Lean.Parser.Command.end
|
|
#[Lean.mkAtom "end", mkOptionalNode id]
|
|
elabEnd node
|
|
|
|
end MyNamespace -- print "bla"
|
|
|
|
end Something'' -- should print nothing
|
|
|
|
namespace Something''
|
|
namespace MyNamespace
|
|
end MyNamespace -- print "bla"
|
|
end Something'' -- should print nothing
|