From 21e0e80849611b0669d7cfea3632a11b065d44c6 Mon Sep 17 00:00:00 2001 From: Jakob Peters Date: Thu, 13 Jun 2024 14:52:11 -0700 Subject: [PATCH] Update ExplicitImports.jl tests --- docs/make.jl | 6 ++++-- src/Typstry.jl | 5 ++++- test/Project.toml | 4 +++- test/runtests.jl | 27 +++++++++++++++++++++++---- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 52989a3..5720b1b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,7 +1,9 @@ -using Base: Docs.HTML, Docs.Text, get_extension +using Base: get_extension using Dates: Dates, Date, DateTime, Day, Hour, Minute, Second, Time, Week -using Documenter: Documenter, DocMeta.setdocmeta!, deploydocs, makedocs +using .Docs: HTML, Text +using .DocMeta: setdocmeta! +using Documenter: Documenter, deploydocs, makedocs using LaTeXStrings: LaTeXStrings, LaTeXString, @L_str using Luxor: Drawing, finish, julia_blue, julia_green, julia_purple, julia_red, rect, sethue using Markdown: Markdown, MD, @md_str diff --git a/src/Typstry.jl b/src/Typstry.jl index 7d1d04b..abb44a2 100644 --- a/src/Typstry.jl +++ b/src/Typstry.jl @@ -6,7 +6,10 @@ import Base: getindex, hash, ignorestatus, isvalid, iterate, keys, lastindex, length, ncodeunits, pointer, repr, run, setenv, show, showerror using Artifacts: @artifact_str -using Base: Docs.HTML, Docs.Text, Iterators.Stateful, Meta.parse, escape_raw_string, escape_string +using Base: escape_raw_string, escape_string +using .Docs: HTML, Text +using .Iterators: Stateful +using .Meta: parse using PrecompileTools: @compile_workload using Typst_jll: typst diff --git a/test/Project.toml b/test/Project.toml index 9401db8..37779d6 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,8 +1,10 @@ [deps] +Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7" +LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" +Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] Documenter = "1" -ExplicitImports = "1" diff --git a/test/runtests.jl b/test/runtests.jl index ab32953..b35ecdc 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,12 +1,31 @@ -using ExplicitImports: check_no_implicit_imports, check_no_stale_explicit_imports -using Test: @testset, @test, detect_ambiguities, detect_unbound_args +using Base: get_extension +using ExplicitImports: + check_all_explicit_imports_are_public, + check_all_explicit_imports_via_owners, + check_all_qualified_accesses_are_public, + check_all_qualified_accesses_via_owners, + check_no_implicit_imports, + check_no_self_qualified_accesses, + check_no_stale_explicit_imports +using Dates: Dates using Documenter: DocMeta.setdocmeta!, doctest +using LaTeXStrings: LaTeXStrings +using Markdown: Markdown +using Test: @testset, @test, detect_ambiguities, detect_unbound_args using Typstry -@testset "`check_no_implicit_imports` and `check_no_stale_explicit_imports`" begin +const MarkdownExtension = get_extension(Typstry, :MarkdownExtension) + +@testset "ExplicitImports.jl" begin + @test isnothing(check_all_explicit_imports_are_public(Typstry; ignore = (:MD, :Stateful, + :code_mode, :depth, :escape_raw_string, :indent, :parse, :print_parameters, :show_raw, :workload))) + @test isnothing(check_all_explicit_imports_via_owners(Typstry)) + @test isnothing(check_all_qualified_accesses_are_public(Typstry)) + @test isnothing(check_all_qualified_accesses_via_owners(Typstry)) @test isnothing(check_no_implicit_imports(Typstry)) - @test isnothing(check_no_stale_explicit_imports(Typstry; ignore = (:Docs, :Iterators, :Meta))) + @test isnothing(check_no_self_qualified_accesses(Typstry)) + @test isnothing(check_no_stale_explicit_imports(Typstry)) end @testset "`detect_ambiguities` and `detect_unbound_args`" begin