diff --git a/test/TestCommands.jl b/test/TestCommands.jl index 0dad800..f76a1e3 100644 --- a/test/TestCommands.jl +++ b/test/TestCommands.jl @@ -1,4 +1,69 @@ module TestCommands +using Test: @test, @testset, @test_throws, @test_warn +using Typstry + +const tc = typst`help` +const tc_error = typst`` +const tc_ignorestatus = ignorestatus(tc_error) + +@testset "`Typstry`" begin + @testset "`TypstCommand`" begin end + + @testset "`TypstError`" begin end + + @testset "`@typst_cmd`" begin end + + @testset "`julia_mono`" begin + # TODO: write more tests + @test julia_mono isa String + end + + @testset "`render`" begin end +end + +@testset "`Base`" begin + @testset "`==`" begin end + + @testset "`addenv`" begin end + + @testset "`detach`" begin end + + @testset "`eltype`" begin @test eltype(TypstCommand) == String end + + @testset "`firstindex`" begin @test firstindex(tc) == 1 end + + @testset "`getindex`" begin end + + @testset "`hash`" begin end + + @testset "`ignorestatus`" begin + @test tc_ignorestatus == TypstCommand(tc_error; ignorestatus = true) + @test_warn "error" run(tc_ignorestatus) + end + + @testset "`iterate`" begin end + + @testset "`keys`" begin end + + @testset "`lastindex`" begin end + + @testset "`length`" begin end + + @testset "`run`" begin + # TODO: write more tests + @test_throws TypstError redirect_stderr(() -> run(tc_error), devnull) + @test_warn "error" try run(tc_error) catch end + end + + @testset "`setcpuaffinity`" begin end + + @testset "`setenv`" begin end + + @testset "`show`" begin end + + @testset "`showerror`" begin end +end + end # TestCommands diff --git a/test/TestStrings.jl b/test/TestStrings.jl index c75b8f4..fe3ee7e 100644 --- a/test/TestStrings.jl +++ b/test/TestStrings.jl @@ -21,34 +21,52 @@ const x_context = Dict(:x => 1) context(::X) = x_context -@testset "`Mode`" begin - @test Mode <: Enum - @test instances(Mode) == map(Mode, (0, 1, 2)) == (code, markup, math) -end +@testset "`Typstry`" begin + @testset "`Mode`" begin + @test Mode <: Enum + @test instances(Mode) == map(Mode, (0, 1, 2)) == (code, markup, math) + end -@testset "`Typst`" begin - @test typst == typst - @test typst != Typst(1.0) - @test typeof(typst) == Typst{Int} - @test string(typst) == "Typst{Int64}(1)" -end + @testset "`Typst`" begin + @test typst == typst + @test typst != Typst(1.0) + @test typeof(typst) == Typst{Int} + @test string(typst) == "Typst{Int64}(1)" + end + + @testset "`TypstString`" begin end -@testset "`TypstString`" begin end + @testset "`TypstText`" begin end -@testset "`TypstText`" begin end + @testset "`@typst_str`" begin end -@testset "`@typst_str`" begin end + @testset "`context`" begin + @test context(1) == Dict{Symbol, Union{}}() + @test context(X()) == x_context + @test context(typst) == default_context + @test context(Typst(x)) == merge(default_context, x_context) + end -@testset "`context`" begin - @test context(1) == Dict{Symbol, Union{}}() - @test context(X()) == x_context - @test context(typst) == default_context - @test context(Typst(x)) == merge(default_context, x_context) + @testset "`show_typst`" begin end end -@testset "`show_typst`" begin end +@testset "`Base`" begin + @testset "`IOBuffer`" begin end + + @testset "`codeunit`" begin end + + @testset "`isvalid`" begin end -@testset "`Base`" begin end + @testset "`iterate`" begin end + + @testset "`ncodeunits`" begin end + + @testset "`pointer`" begin end + + @testset "`repr`" begin end + + @testset "`show`" begin end +end end # TestStrings