2023-12-05 19:07:00 -08:00
|
|
|
|
import LSpec
|
|
|
|
|
import Pantograph.Serial
|
2023-12-15 10:40:36 -08:00
|
|
|
|
import Pantograph.Environment
|
2023-12-05 19:07:00 -08:00
|
|
|
|
|
2023-12-26 09:22:57 -08:00
|
|
|
|
namespace Pantograph.Test.Environment
|
2023-12-05 19:07:00 -08:00
|
|
|
|
|
|
|
|
|
open Pantograph
|
|
|
|
|
open Lean
|
|
|
|
|
|
|
|
|
|
def test_symbol_visibility (env: Environment): IO LSpec.TestSeq := do
|
|
|
|
|
let entries: List (Name × Bool) := [
|
|
|
|
|
("Nat.add_comm".toName, false),
|
2023-12-08 16:17:16 -08:00
|
|
|
|
("Lean.Name".toName, true)
|
2023-12-05 19:07:00 -08:00
|
|
|
|
]
|
|
|
|
|
let suite := entries.foldl (λ suites (symbol, target) =>
|
|
|
|
|
let constant := env.constants.find! symbol
|
2023-12-15 10:40:36 -08:00
|
|
|
|
let test := LSpec.check symbol.toString ((Environment.is_symbol_unsafe_or_internal symbol constant) == target)
|
2023-12-05 19:07:00 -08:00
|
|
|
|
LSpec.TestSeq.append suites test) LSpec.TestSeq.done
|
|
|
|
|
return suite
|
|
|
|
|
|
|
|
|
|
def suite: IO LSpec.TestSeq := do
|
|
|
|
|
let env: Environment ← importModules
|
|
|
|
|
(imports := #["Init"].map (λ str => { module := str.toName, runtimeOnly := false }))
|
|
|
|
|
(opts := {})
|
|
|
|
|
(trustLevel := 1)
|
|
|
|
|
|
2023-12-26 09:22:57 -08:00
|
|
|
|
return LSpec.group "Environment" $
|
2023-12-05 19:07:00 -08:00
|
|
|
|
(LSpec.group "Symbol visibility" (← test_symbol_visibility env))
|
|
|
|
|
|
2023-12-26 09:22:57 -08:00
|
|
|
|
end Pantograph.Test.Environment
|