mirror of
https://github.com/Smaug123/agda-utils
synced 2025-10-06 03:58:41 +00:00
Initial commit of the bones of an unused-open-removing Agda tool
This commit is contained in:
35
AgdaUnusedOpens.Test/TestAgdaFile.fs
Normal file
35
AgdaUnusedOpens.Test/TestAgdaFile.fs
Normal file
@@ -0,0 +1,35 @@
|
||||
namespace AgdaUnusedOpens.Test
|
||||
|
||||
open AgdaUnusedOpens
|
||||
open NUnit.Framework
|
||||
open FsUnitTyped
|
||||
|
||||
[<TestFixture>]
|
||||
module TestAgdaFile =
|
||||
|
||||
[<Test>]
|
||||
let ``Make example`` () =
|
||||
let agdaFile =
|
||||
"Example.agda"
|
||||
|> Utils.getResource'
|
||||
|> AgdaFile.make
|
||||
agdaFile.ModuleLine
|
||||
|> shouldEqual 20
|
||||
agdaFile.Path.Head
|
||||
|> shouldEqual "Rings"
|
||||
agdaFile.Path.Tail
|
||||
|> shouldEqual ["EuclideanDomains" ; "Definition"]
|
||||
|
||||
[<Test>]
|
||||
let ``Rename example`` () =
|
||||
let agdaFile =
|
||||
"Example.agda"
|
||||
|> Utils.getResource'
|
||||
|> AgdaFile.make
|
||||
let newFile = AgdaFile.rename "NewModule" agdaFile
|
||||
newFile.ModuleLine |> shouldEqual 20
|
||||
newFile.Path.Head |> shouldEqual "Rings"
|
||||
newFile.Path.Tail |> shouldEqual ["EuclideanDomains" ; "NewModule"]
|
||||
|
||||
let expected = "module Rings.EuclideanDomains.NewModule {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ _*_ : A → A → A} (R : Ring S _+_ _*_) where"
|
||||
newFile.Contents.[20] |> shouldEqual expected
|
Reference in New Issue
Block a user