Skip to content

Commit

Permalink
Improves tests. Fixes imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Azzaare committed Jul 31, 2024
1 parent 9467a44 commit 645594f
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 11 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@
/docs/build/
/docs/Manifest.toml

/perf/Manifest.toml
/perf/Manifest.toml

.gitignore

.DS_Store
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ julia = "1.7"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"

[targets]
test = ["Aqua", "Test", "TestItemRunner"]
test = ["Aqua", "ExplicitImports", "JET", "Test", "TestItemRunner"]
4 changes: 2 additions & 2 deletions src/ConstraintCommons.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module ConstraintCommons

#!SECTION -- Imports
using Dictionaries
using TestItems
import Dictionaries: AbstractDictionary, Dictionary, set!
import TestItems: @testitem

#!SECTION -- Exports

Expand Down
5 changes: 3 additions & 2 deletions src/nothing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ consisempty(::Nothing) = true
consisempty(items) = @inline isempty(items)

@testitem "Set: nothing" tags=[:set, :nothing] begin
@test !(ConstraintCommons.consin(42, nothing))
@test ConstraintCommons.consisempty(nothing)
import ConstraintCommons: consin, consisempty
@test !(consin(42, nothing))
@test consisempty(nothing)
end
3 changes: 2 additions & 1 deletion src/symbols.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ function symcon(s1::Symbol, s2::Symbol, connector::AbstractString = "_")
end

@testitem "Symbols" tags=[:symbols] begin
@test ConstraintCommons.symcon(:a, :b) === :a_b
import ConstraintCommons: symcon
@test symcon(:a, :b) === :a_b
end
4 changes: 0 additions & 4 deletions test/Aqua.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
@testset "Aqua.jl" begin
import Aqua
import ConstraintCommons
import Dictionaries

# TODO: Fix the broken tests and remove the `broken = true` flag
Aqua.test_all(
ConstraintCommons;
Expand Down
3 changes: 3 additions & 0 deletions test/ExplicitImports.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@testset "Look for Explicit Imports" begin
@test check_no_implicit_imports(ConstraintCommons) === nothing
end
3 changes: 3 additions & 0 deletions test/JET.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@testset "Code linting (JET.jl)" begin
JET.test_package(ConstraintCommons; target_defined_modules = true)
end
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
using ConstraintCommons

using Aqua
using ExplicitImports
using JET
using Test
using TestItemRunner

@testset "Package tests: ConstraintCommons" begin
include("Aqua.jl")
include("ExplicitImports.jl")
include("JET.jl")
include("TestItemRunner.jl")
end

0 comments on commit 645594f

Please sign in to comment.