Skip to content

Commit

Permalink
added more elaborate unit-tests for valid? calls
Browse files Browse the repository at this point in the history
  • Loading branch information
drkameleon committed Aug 28, 2024
1 parent 6f8649c commit 8523cbb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/tests.art
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,24 @@ loop list ./"../src/plugins" 'location [
not? some? plugin\test\invalid 'v run
]
]
]

import ./"../src/validator.art"!

suite "Test function calls" [
test "single param" [
assert -> valid?.email "drkameleon@gmail.com"
assert -> valid?.url "https://arturo-lang.io"
assert -> not? valid?.email "drkameleon"
assert -> not? valid?.url "arturolang"
]

test "multiple params" [
assert -> valid?.email ["drkameleon@gmail.com", "yaniszaf@gmail.com"]
assert -> valid?.url ["https://www.google.com", "https://arturo-lang.io"]
assert -> not? valid?.email ["drkameleon", "yaniszaf"]
assert -> not? valid?.email ["drkameleon@gmail.com", "yaniszaf"]
assert -> not? valid?.url ["google", "arturolang"]
assert -> not? valid?.url ["https://www.google.com", "arturolang"]
]
]

0 comments on commit 8523cbb

Please sign in to comment.