Skip to content
New issue

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

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

Already on GitHub? # to your account

[Types\to] add unit-tests #1917

Merged
merged 115 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
5e515f4
[Types\to] add test file
RickBarretto Mar 1, 2025
7995431
[Types\to] add test from :null
RickBarretto Mar 1, 2025
593844a
[Types\to] add TODO
RickBarretto Mar 1, 2025
d053a83
[Types\to] add temporary test
RickBarretto Mar 1, 2025
0d1685c
[Types\to] add tests from :logical
RickBarretto Mar 1, 2025
1272c6e
[Types\to] minor fix
RickBarretto Mar 1, 2025
2f5512d
[Types\to] add special syntax for testing
RickBarretto Mar 1, 2025
c234b31
[Types\to] use a simpler syntax
RickBarretto Mar 1, 2025
54368f4
[Types\to] test from :logical
RickBarretto Mar 1, 2025
a3e96e4
[Types\to] minor fix
RickBarretto Mar 1, 2025
4bd1012
[Types\to] add from :integer tests
RickBarretto Mar 1, 2025
15e2d6c
move function to separate module
RickBarretto Mar 1, 2025
2311615
[Types\to] use simpler syntax for tests
RickBarretto Mar 1, 2025
fd1323f
[Types\to] test :null => :rational
RickBarretto Mar 1, 2025
ab2b1c3
[Types\to] test :integer => :char
RickBarretto Mar 1, 2025
6734727
[Types\to] add missing tests to :char
RickBarretto Mar 1, 2025
193aa3d
[Types\to] test :integer => :quantity
RickBarretto Mar 1, 2025
24f71af
[Types\to] test :integer => :date
RickBarretto Mar 1, 2025
61444b3
[Types\to] test :integer => :binary
RickBarretto Mar 1, 2025
722f2f6
[Types\to] add missing tests for :quantity
RickBarretto Mar 1, 2025
4f691d8
[Types\to] add missing tests for :date
RickBarretto Mar 1, 2025
ee2c8fe
[Types\to] test from :floating
RickBarretto Mar 1, 2025
3dab528
[Types\to] minor fix
RickBarretto Mar 1, 2025
3f74547
[Types\to] add more test cases for :floating => :integer
RickBarretto Mar 1, 2025
d2ab3c0
[Types\to] add missing cases
RickBarretto Mar 1, 2025
d56ec76
[Types\to] skip floating test (inconsistent)
RickBarretto Mar 1, 2025
31dd7fa
[Types\to] test :complex => :string
RickBarretto Mar 1, 2025
d8f8a1a
[Types\to] add missing tests
RickBarretto Mar 1, 2025
46feeb7
[Types\to] fix test helper function for :block types
RickBarretto Mar 1, 2025
a90d46f
[Types\to] test :complex => :block
RickBarretto Mar 1, 2025
3dd3f2b
[Types\to] add empty tests for :block
RickBarretto Mar 1, 2025
bed3bd6
[Types\to] test :rational => :floating
RickBarretto Mar 1, 2025
0e8ff88
[Types\to] test :rational => :integer
RickBarretto Mar 1, 2025
3319830
[Types\to] test :rational => :string
RickBarretto Mar 1, 2025
45eca7b
[Types\to] test :rational => :block
RickBarretto Mar 1, 2025
aa1336a
[Types\to] add empty tests
RickBarretto Mar 1, 2025
a58a687
[Types\to] create :version test suite
RickBarretto Mar 1, 2025
b84070d
[Types\to] test :version => :string
RickBarretto Mar 1, 2025
e7d6b7b
minor fix
RickBarretto Mar 1, 2025
9bbb056
[Types\to] add missing :version tests
RickBarretto Mar 1, 2025
13688b6
[Types\to] colapse empty tests
RickBarretto Mar 2, 2025
c6ef6d3
[Types\to] add empty tests
RickBarretto Mar 2, 2025
9d7eb8c
[Types\to] test :type => :string
RickBarretto Mar 2, 2025
58d46e4
[Types\to] add empty tests
RickBarretto Mar 2, 2025
a39aa16
[Types\to] test :char => :string
RickBarretto Mar 2, 2025
f867066
[Types\to] test :char => :integer
RickBarretto Mar 2, 2025
74de29c
[Types\to] test :char => :binary
RickBarretto Mar 2, 2025
8d95c8e
[Types\to] add empty tests
RickBarretto Mar 2, 2025
e91f95e
[Types\to] test :string => :logical
RickBarretto Mar 2, 2025
1fff8f8
[Types\to] test :string => :integer
RickBarretto Mar 2, 2025
92e3f52
[Types\to] test :string => :floating
RickBarretto Mar 2, 2025
fa52374
[Types\to] test :string => :version
RickBarretto Mar 2, 2025
b891d1b
[Types\to] create :type test suite
RickBarretto Mar 2, 2025
d23927b
[Types\to] test :string => :char
RickBarretto Mar 2, 2025
9686029
[Types\to] organize suite alphabetically
RickBarretto Mar 2, 2025
162ddbd
[Types\to] organize :version's tests alphabetically
RickBarretto Mar 2, 2025
d5f427e
[Types\to] organize :type's tests alphabetically
RickBarretto Mar 2, 2025
62a3bc0
[Types\to] organize :string's tests alphabetically
RickBarretto Mar 2, 2025
d146992
[Types\to] organize :rational's tests alphabetically
RickBarretto Mar 2, 2025
240507f
[Types\to] organize :quantity's tests alphabetically
RickBarretto Mar 2, 2025
7cca4bc
[Types\to] organize :logical's tests alphabetically
RickBarretto Mar 2, 2025
f5483bc
[Types\to] organize :integer's tests alphabetically
RickBarretto Mar 2, 2025
f24fef9
[Types\to] organize :floating's tests alphabetically
RickBarretto Mar 2, 2025
4a8d48e
[Types\to] organize :date's tests alphabetically
RickBarretto Mar 2, 2025
e599ce3
[Types\to] organize :char's tests alphabetically
RickBarretto Mar 2, 2025
63056f9
[Types\to] organize :block's tests alphabetically
RickBarretto Mar 2, 2025
8068ad6
[Types\to] organize :binary's tests alphabetically
RickBarretto Mar 2, 2025
1f01561
[Types\to] create :word test suite
RickBarretto Mar 2, 2025
df17448
[Types\to] test :string => :word
RickBarretto Mar 2, 2025
ad33618
[Types\to] create :literal test suite
RickBarretto Mar 2, 2025
3b592d7
[Types\to] test :string => :word
RickBarretto Mar 2, 2025
a7f2907
[Types\to] test :string => :label
RickBarretto Mar 2, 2025
5b2d6ff
[Types\to] test :string => :attribute/:attributeLabel
RickBarretto Mar 2, 2025
f98be55
[Types\to] test :string => :symbol
RickBarretto Mar 2, 2025
f54248a
[Types\to] test :string => :errorKind
RickBarretto Mar 2, 2025
b5b0246
[Types\to] test :string => :regex
RickBarretto Mar 2, 2025
358b845
[Types\to] add comment
RickBarretto Mar 2, 2025
5ac2231
[Types\to] test :string => :block
RickBarretto Mar 2, 2025
2f3f4be
[Types\to] test :string => :color
RickBarretto Mar 2, 2025
bfe42e1
[Types\to] minor test fix
RickBarretto Mar 2, 2025
ef100d1
[Types\to] test :string => :date
RickBarretto Mar 2, 2025
3ea1ad8
[Types\to] test :literal => :literal
RickBarretto Mar 2, 2025
5ad3f25
[Types\to] test :literal => :string
RickBarretto Mar 2, 2025
4c70aca
[Types\to] test :literal => :word
RickBarretto Mar 2, 2025
e14756e
[Types\to] test :word => :string
RickBarretto Mar 2, 2025
f8078e9
[Types\to] test :word => :literal
RickBarretto Mar 2, 2025
9534a94
[Types\to] test :word => :word
RickBarretto Mar 2, 2025
cc433b2
[Types\to] test :attribute(Label) => :string
RickBarretto Mar 2, 2025
8b02efb
[Types\to] test :attribute(Label) => :literal
RickBarretto Mar 2, 2025
04ae7b7
[Types\to] add TODO
RickBarretto Mar 2, 2025
6bec017
[Types\to] test :literal => :block
RickBarretto Mar 2, 2025
1906ca4
[Types\to] add empty tests
RickBarretto Mar 2, 2025
0cde62f
[Types\to] test :block => :complex
RickBarretto Mar 2, 2025
19740e8
[Types\to] test :block => :rational
RickBarretto Mar 2, 2025
2161c56
[Types\to] test :block => :string
RickBarretto Mar 2, 2025
5b407ce
[Types\to] test :block => :inline
RickBarretto Mar 2, 2025
8d2445f
[Types\to] test :block => :dictionary
RickBarretto Mar 2, 2025
bee8afd
[Types\to] test :block => :quantity
RickBarretto Mar 2, 2025
f75d025
[Types\to] test :block => :color
RickBarretto Mar 2, 2025
9dc0b55
[Types\to] test :range => :block
RickBarretto Mar 2, 2025
9bae276
[Types\to] test :dictionary => :string
RickBarretto Mar 2, 2025
1e5483c
[Types\to] test :symbol => :string
RickBarretto Mar 2, 2025
8a8944f
[Types\to] test :quantity => :floating
RickBarretto Mar 2, 2025
283100f
[Types\to] test :quantity => :rational
RickBarretto Mar 2, 2025
b18e6a2
[Types\to] test :quantity => :string
RickBarretto Mar 2, 2025
5b60526
[Types\to] test :quantity => :unit
RickBarretto Mar 2, 2025
4abe5c5
[Types\to] test :unit => :string
RickBarretto Mar 2, 2025
c735b36
[Types\to] test :error => :string
RickBarretto Mar 2, 2025
8e20d92
[Types\to] test :error => :literal
RickBarretto Mar 2, 2025
c09bbc3
[Types\to] test :errorKind => :literal
RickBarretto Mar 2, 2025
4753dee
[Types\to] test :errorKind => :string
RickBarretto Mar 2, 2025
caa33e1
[Types\to] test :regex => :string
RickBarretto Mar 2, 2025
a97dd06
[Types\to] test :color => :string
RickBarretto Mar 2, 2025
57ea521
[Types\to] use `->>` instead of `>>` it's alias of `write`
RickBarretto Mar 4, 2025
5712625
Merge branch 'arturo-lang:master' into test-type-to-issue-1354
RickBarretto Mar 4, 2025
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
1 change: 1 addition & 0 deletions src/helpers/conversion.nim
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ proc convertedValueToType*(x, y: Value, tp: ValueKind, aFormat:Value = nil): Val
case y.kind:
of Null:
case tp:
# TODO(Converters) should support :null -> :floating
of Logical: return VFALSE
of Integer: return I0
of String: return newString("null")
Expand Down
24 changes: 24 additions & 0 deletions tests/unitt/lib/types/to.helper.art
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
for: $[targetType :type sections :block][
section: $[sourceType :type cases :block][
test ~"|sourceType| => |targetType|:"
flatten.once map @cases 'p [
source: first p
expected: last p
assertion: [equal?]
| append @[expected]
| append [to]
| append targetType
| append @[source]

[assert] ++ @[assertion]
]
]

do sections
]

pair: $[source target][
@[source target]
]

alias.infix {->>} 'pair
Loading
Loading