1
0
mirror of https://github.com/janet-lang/janet synced 2025-09-06 12:58:04 +00:00

Added misc tests to increase test coverage

This commit is contained in:
Ico Doornekamp
2023-06-03 18:59:19 +02:00
parent 15177ac2e9
commit c0f5f97ddb
8 changed files with 143 additions and 2 deletions

View File

@@ -78,5 +78,17 @@
(assert (struct/getproto (struct/with-proto {:a 1} :b 2 :c nil))
"missing struct proto")
# struct/with-proto
(assert-error "expected odd number of arguments" (struct/with-proto {} :a))
# struct/to-table
(def s (struct/with-proto {:a 1 :b 2} :name "john" ))
(def t1 (struct/to-table s true))
(def t2 (struct/to-table s false))
(assert (deep= t1 @{:name "john"}) "struct/to-table 1")
(assert (deep= t2 @{:name "john"}) "struct/to-table 2")
(assert (deep= (getproto t1) @{:a 1 :b 2}) "struct/to-table 3")
(assert (deep= (getproto t2) nil) "struct/to-table 4")
(end-suite)