2023-12-05 19:07:00 -08:00
|
|
|
|
import LSpec
|
|
|
|
|
import Pantograph.Serial
|
|
|
|
|
import Pantograph.Symbol
|
|
|
|
|
|
|
|
|
|
namespace Pantograph.Test.Catalog
|
|
|
|
|
|
|
|
|
|
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-12 18:56:25 -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
|
|
|
|
|
let test := LSpec.check symbol.toString ((is_symbol_unsafe_or_internal symbol constant) == target)
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
return LSpec.group "Catalog" $
|
|
|
|
|
(LSpec.group "Symbol visibility" (← test_symbol_visibility env))
|
|
|
|
|
|
|
|
|
|
end Pantograph.Test.Catalog
|