-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test/test_plot_diagnostics.jl: Additional tests for plotting.
- Loading branch information
Showing
4 changed files
with
48 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Test | ||
using LineageCollapse | ||
|
||
@testset "Plot Diagnostics" begin | ||
@testset "CairoMakie not imported" begin | ||
# Ensure CairoMakie is not imported | ||
if isdefined(Main, :CairoMakie) | ||
@warn "CairoMakie is already imported, which may affect the test results" | ||
end | ||
|
||
# Test that the function throws an error with the correct message | ||
@test_throws ErrorException("Import CairoMakie to enable plotting") plot_diagnostics() | ||
|
||
# Test with arguments | ||
@test_throws ErrorException("Import CairoMakie to enable plotting") plot_diagnostics(rand(10)) | ||
|
||
# Test with keyword arguments | ||
@test_throws ErrorException("Import CairoMakie to enable plotting") plot_diagnostics(color="red") | ||
end | ||
|
||
@testset "CairoMakie imported" begin | ||
# Create a temporary module to simulate CairoMakie being imported | ||
@eval Main module TestPlotDiagnostics | ||
using LineageCollapse | ||
|
||
# Simulate CairoMakie being imported | ||
LineageCollapse.eval(:(CairoMakie = 1)) | ||
|
||
using Test | ||
@test_throws ErrorException("Invalid method call") plot_diagnostics() | ||
@test_throws ErrorException("Invalid method call") plot_diagnostics(rand(10)) | ||
@test_throws ErrorException("Invalid method call") plot_diagnostics(color="red") | ||
end | ||
end | ||
end |