-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modify @withmetadata to filter strings
- Loading branch information
Showing
2 changed files
with
39 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@testitem "Test metadata decoration" begin | ||
using QuantumSymbolics: Metadata, @withmetadata | ||
|
||
@withmetadata struct Foo1 | ||
a::Int | ||
end | ||
@test Foo1(2).metadata isa Metadata | ||
|
||
@withmetadata struct Foo2 | ||
"hi" | ||
a::Int | ||
end | ||
@test Foo2(2).metadata isa Metadata | ||
|
||
@withmetadata struct Foo3{T<:Int} | ||
"hi" | ||
a::T | ||
"hi" | ||
b::T | ||
end | ||
@test Foo3{Int}(2, 3).metadata isa Metadata | ||
|
||
@withmetadata struct Foo4{T<:Int} <: Integer | ||
a::T | ||
b::T | ||
end | ||
@test Foo4{Int}(2, 3).metadata isa Metadata | ||
|
||
@withmetadata struct Foo5 <: Integer | ||
a | ||
end | ||
@test Foo5(2).metadata isa Metadata | ||
|
||
@withmetadata struct Foo6 <: Integer end | ||
@test Foo6().metadata isa Metadata | ||
end |