test: Environment.addExtraName
This commit is contained in:
parent
bdad9aaa99
commit
1fb112f84b
5 changed files with 31 additions and 0 deletions
|
|
@ -19,6 +19,8 @@ def EnvExtensionState : Type := EnvExtensionStateSpec.fst
|
|||
instance : Inhabited EnvExtensionState := EnvExtensionStateSpec.snd
|
||||
|
||||
def ModuleIdx := Nat
|
||||
deriving BEq, ToString
|
||||
|
||||
abbrev ModuleIdx.toNat (midx : ModuleIdx) : Nat := midx
|
||||
|
||||
instance : Inhabited ModuleIdx := inferInstanceAs (Inhabited Nat)
|
||||
|
|
|
|||
11
tests/pkg/misc/Misc.lean
Normal file
11
tests/pkg/misc/Misc.lean
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import Misc.Foo
|
||||
import Lean
|
||||
|
||||
open Lean Meta
|
||||
|
||||
#eval id (α := MetaM Unit) do
|
||||
assert! (← getEnv).getModuleIdxFor? ``foo == (← getEnv).getModuleIdxFor? `auxDecl1
|
||||
IO.println <| (← getEnv).getModuleIdxFor? ``Lean.Environment
|
||||
IO.println <| (← getEnv).getModuleIdxFor? ``foo
|
||||
IO.println <| (← getEnv).getModuleIdxFor? `auxDecl1
|
||||
IO.println "worked"
|
||||
9
tests/pkg/misc/Misc/Foo.lean
Normal file
9
tests/pkg/misc/Misc/Foo.lean
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import Lean
|
||||
|
||||
open Lean Meta
|
||||
|
||||
#eval id (α := MetaM Unit) do
|
||||
modifyEnv fun env => env.addExtraName `auxDecl1
|
||||
return ()
|
||||
|
||||
def foo := 42
|
||||
5
tests/pkg/misc/lakefile.lean
Normal file
5
tests/pkg/misc/lakefile.lean
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import Lake
|
||||
open System Lake DSL
|
||||
|
||||
package misc
|
||||
@[defaultTarget] lean_lib Misc
|
||||
4
tests/pkg/misc/test.sh
Executable file
4
tests/pkg/misc/test.sh
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
rm -rf build
|
||||
lake build
|
||||
Loading…
Add table
Reference in a new issue