From 5f514765265a4d2e83cbcb47e96245c655c9d99c Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 12 Oct 2019 22:03:34 -0500 Subject: [PATCH] Remove a git attribute for linguist. --- .gitattributes | 2 -- src/core/pp.c | 2 +- test/suite7.janet | 7 +++++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.gitattributes b/.gitattributes index 3759b29d..e69de29b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +0,0 @@ -# Use an approximate language for syntax highlighting (clojure is pretty close) -*.janet linguist-language=clojure diff --git a/src/core/pp.c b/src/core/pp.c index a2a588de..9a8e27b0 100644 --- a/src/core/pp.c +++ b/src/core/pp.c @@ -406,7 +406,7 @@ static void janet_pretty_one(struct pretty *S, Janet x, int is_dict_value) { if (S->depth == 0) { janet_buffer_push_cstring(S->buffer, "..."); } else { - if (!isarray && len >= JANET_PRETTY_IND_ONELINE) + if (!isarray && !(S->flags & JANET_PRETTY_ONELINE) && len >= JANET_PRETTY_IND_ONELINE) janet_buffer_push_u8(S->buffer, ' '); if (is_dict_value && len >= JANET_PRETTY_IND_ONELINE) print_newline(S, 0); for (i = 0; i < len; i++) { diff --git a/test/suite7.janet b/test/suite7.janet index 437409f9..ff30be3f 100644 --- a/test/suite7.janet +++ b/test/suite7.janet @@ -154,6 +154,7 @@ (assert (= (((|||4))) 4) "function shorthand 7") (assert (= (|(+ $1 $1 $1 $1) 2 4) 16) "function shorthand 8") (assert (= (|(+ $0 $1 $3 $2 $6) 0 1 2 3 4 5 6) 12) "function shorthand 9") +(assert (= (|(+ $0 $99) ;(range 100)) 99) "function shorthand 10") # Simple function break (debug/fbreak map 1) @@ -163,4 +164,10 @@ (debug/unfbreak map 1) (map inc [1 2 3]) +# Simple take, drop, etc. tests. +(assert (deep= (take 10 (range 100)) (range 10)) "take 10") +(assert (deep= (drop 10 (range 100)) (range 10 100)) "drop 10") + + + (end-suite)