mirror of
https://github.com/janet-lang/janet
synced 2025-10-19 09:47:40 +00:00
Fix some code style, add tuple/type function.
We need to be able to detect tuple type from janet code, otherwise tuples will contain hidden state. The tuple/type function is able to detect the flags in the tuple so the programmer can access them if needed.
This commit is contained in:
@@ -351,4 +351,12 @@
|
||||
(def t (put @{} :hi 1))
|
||||
(assert (deep= t @{:hi 1}) "regression #24")
|
||||
|
||||
# Tuple types
|
||||
|
||||
(assert (= (tuple/type '(1 2 3)) :parens) "normal tuple")
|
||||
(assert (= (tuple/type [1 2 3]) :parens) "normal tuple 1")
|
||||
(assert (= (tuple/type '[1 2 3]) :brackets) "bracketed tuple 2")
|
||||
(assert (= (tuple/type (-> '(1 2 3) marshal unmarshal)) :parens) "normal tuple marshalled/unmarshalled")
|
||||
(assert (= (tuple/type (-> '[1 2 3] marshal unmarshal)) :brackets) "normal tuple marshalled/unmarshalled")
|
||||
|
||||
(end-suite)
|
||||
|
Reference in New Issue
Block a user