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
|
|
|
|
|
|
|
|
|
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-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)
|
|
|
|
|
|
|
|
|
|
return LSpec.group "Catalog" $
|
|
|
|
|
(LSpec.group "Symbol visibility" (← test_symbol_visibility env))
|
|
|
|
|
|
|
|
|
|
end Pantograph.Test.Catalog
|