1
0
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:
Calvin Rose
2019-02-09 12:21:11 -05:00
parent 5020a1bae9
commit c6edf03ae8
6 changed files with 46 additions and 29 deletions

View File

@@ -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)