Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for nonexistent names in acset macro #110

Merged
merged 1 commit into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/DenseACSets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,11 @@
s = Schema(S)
end
acs = T()
@ct begin

Check warning on line 991 in src/DenseACSets.jl

View check run for this annotation

Codecov / codecov/patch

src/DenseACSets.jl#L991

Added line #L991 was not covered by tests
for n in names
(n ∈ types(s) || n ∈ arrows(s; just_names=true)) || error("$(n) is not defined in schema")
end
end
@ct_ctrl for ob in intersect(types(s), names)
add_parts!(acs, @ct(ob), rows[@ct ob])
end
Expand Down
7 changes: 7 additions & 0 deletions test/ACSets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,13 @@ l = @acset DecGraph{String} begin
dec = ["a","a"]
end

# errors when user inputs nonexistent names
@test_throws Exception @acset DDS begin
W=3
Φ=[1,2,3]
end


# Test mapping
#-------------

Expand Down
Loading