Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidanthoff committed Jul 17, 2024
1 parent 799a257 commit ed1f2ed
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions test/test_testitems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "Your @testitem is missing a name and code block.", 1:9)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "Test definition error", "Your @testitem is missing a name and code block.", 1:9)
end

@testitem "Wrong type for name" begin
Expand All @@ -37,7 +37,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "Your @testitem must have a first argument that is of type String for the name.", 1:14)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "Test definition error", "Your @testitem must have a first argument that is of type String for the name.", 1:14)
end

@testitem "Code block missing" begin
Expand All @@ -58,7 +58,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "Your @testitem is missing a code block argument.", 1:15)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "foo", "Your @testitem is missing a code block argument.", 1:15)
end

@testitem "Final arg not a code block" begin
Expand All @@ -79,7 +79,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "The final argument of a @testitem must be a begin end block.", 1:17)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "foo", "The final argument of a @testitem must be a begin end block.", 1:17)
end

@testitem "None kw arg" begin
Expand All @@ -100,7 +100,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "The arguments to a @testitem must be in keyword format.", 1:29)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "foo", "The arguments to a @testitem must be in keyword format.", 1:29)
end

@testitem "Duplicate kw arg" begin
Expand All @@ -121,7 +121,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "The keyword argument default_imports cannot be specified more than once.", 1:68)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "foo", "The keyword argument default_imports cannot be specified more than once.", 1:68)
end

@testitem "Incomplete kw arg" begin
Expand All @@ -142,7 +142,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "The final argument of a @testitem must be a begin end block.", 1:42)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "foo", "The final argument of a @testitem must be a begin end block.", 1:42)
end

@testitem "Wrong default_imports type kw arg" begin
Expand All @@ -163,7 +163,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "The keyword argument default_imports only accepts bool values.", 1:43)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "foo", "The keyword argument default_imports only accepts bool values.", 1:43)
end

@testitem "non vector arg for tags kw" begin
Expand All @@ -184,7 +184,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "The keyword argument tags only accepts a vector of symbols.", 1:32)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "foo", "The keyword argument tags only accepts a vector of symbols.", 1:32)
end

@testitem "Wrong types in tags kw arg" begin
Expand All @@ -205,7 +205,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "The keyword argument tags only accepts a vector of symbols.", 1:37)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "foo", "The keyword argument tags only accepts a vector of symbols.", 1:37)
end

@testitem "Unknown keyword arg" begin
Expand All @@ -226,7 +226,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "Unknown keyword argument.", 1:34)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "foo", "Unknown keyword argument.", 1:34)
end

@testitem "All parts correctly there" begin
Expand Down Expand Up @@ -276,7 +276,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "Your @testmodule is missing a name and code block.", 1:length(content)-1)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "Test definition error", "Your @testmodule is missing a name and code block.", 1:length(content)-1)
end

@testitem "@testsnippet macro missing begin end block" begin
Expand All @@ -297,7 +297,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "Your @testsnippet is missing a name and code block.", 1:length(content)-1)
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "Test definition error", "Your @testsnippet is missing a name and code block.", 1:length(content)-1)
end

@testitem "@testmodule macro extra args" begin
Expand All @@ -317,7 +317,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "Your @testmodule must have a first argument that is an identifier for the name.", 1:length(content))
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "Test definition error", "Your @testmodule must have a first argument that is an identifier for the name.", 1:length(content))
end

@testitem "@testsnippet macro extra args" begin
Expand All @@ -337,7 +337,7 @@ end
@test length(test_results.testsetups) == 0
@test length(test_results.testerrors) == 1

@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "Your @testsnippet must have a first argument that is an identifier for the name.", 1:length(content))
@test test_results.testerrors[1] == TestErrorDetail(uri"file://src/foo.jl", "file://src/foo.jl:error1", "Test definition error", "Your @testsnippet must have a first argument that is an identifier for the name.", 1:length(content))
end

@testitem "@testmodule all correct" begin
Expand Down

0 comments on commit ed1f2ed

Please sign in to comment.