{-# LANGUAGE OverloadedStrings #-}-- SPDX-FileCopyrightText: Copyright (c) 2025 Objectionary.com-- SPDX-License-Identifier: MITmodule TauSpec whereimport ASTimport Control.Monad (replicateM)import Tau (freshTau, seedTaus)import Test.Hspec (Spec, describe, it, shouldBe)spec :: Specspec = describe "Tau" $ do it "mints sequential names after seeding from an empty document" $ do seedTaus (Program (ExFormation [])) names <- replicateM 3 freshTau names `shouldBe` ["a🌵0", "a🌵1", "a🌵2"] it "resets the cursor on every seeding so output is deterministic" $ do seedTaus (Program (ExFormation [])) first <- freshTau seedTaus (Program (ExFormation [])) second <- freshTau (first, second) `shouldBe` ("a🌵0", "a🌵0") it "skips names already taken in the document" $ do seedTaus ( Program ( ExFormation [ BiTau (AtLabel "a🌵0") ExGlobal , BiTau (AtLabel "a🌵2") ExGlobal ] ) ) names <- replicateM 2 freshTau names `shouldBe` ["a🌵1", "a🌵3"]