From 4055d740076ca87e08b41c1cef9733f6ad5053c5 Mon Sep 17 00:00:00 2001 From: Chris Oakman Date: Sun, 20 Oct 2024 00:04:56 -0500 Subject: [PATCH] WIP WIP WIP --- lib/standard-clojure-style.js | 4 +++ test/format.test.js | 3 +- test_format/ns.eno | 65 +++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) diff --git a/lib/standard-clojure-style.js b/lib/standard-clojure-style.js index 4a931c8..78901b8 100644 --- a/lib/standard-clojure-style.js +++ b/lib/standard-clojure-style.js @@ -3144,6 +3144,10 @@ outTxt = strConcat(outTxt, ' ') isImportKeywordPrinted = true } else if (isFirstPlatform) { + if (!isImportKeywordPrinted) { + outTxt = strConcat(outTxt, '\n (:import') + isImportKeywordPrinted = true + } outTxt = strConcat3(outTxt, '\n #?@(', platformStr) outTxt = strConcat(outTxt, '\n [') isFirstPlatform = false diff --git a/test/format.test.js b/test/format.test.js index 4d08e98..c3442dc 100644 --- a/test/format.test.js +++ b/test/format.test.js @@ -64,9 +64,10 @@ test('All test_format/ cases should have unique names', () => { // dev convenience: set this to true and add specific test cases // only those cases will run -const onlyRunSpecificTests = false +const onlyRunSpecificTests = true const specificTests = new Set() // specificTests.add('your test case here') +specificTests.add('portal.runtime.cson 1') const ignoreSomeTests = true const ignoreTests = new Set() diff --git a/test_format/ns.eno b/test_format/ns.eno index 54d915f..76c7cd7 100644 --- a/test_format/ns.eno +++ b/test_format/ns.eno @@ -1590,3 +1590,68 @@ #?(:clj (def ^:dynamic *unchecked-if* false)) #?(:clj (def ^:dynamic *unchecked-arrays* false)) --Expected + +# portal.runtime.cson 1 + +--Input +(ns ^:no-doc portal.runtime.cson + "Clojure/Script Object Notation" + (:refer-clojure :exclude [read]) + #?(:clj (:require [portal.runtime.json-buffer :as json]) + :cljr (:require [portal.runtime.json-buffer :as json]) + :joyride + (:require + [portal.runtime.json-buffer :as json] + [portal.runtime.macros :as m]) + :org.babashka/nbb + (:require + [portal.runtime.json-buffer :as json] + [portal.runtime.macros :as m]) + :cljs + (:require + [goog.crypt.base64 :as Base64] + [portal.runtime.json-buffer :as json] + [portal.runtime.macros :as m])) + #?(:clj (:import [java.net URL] + [java.util Base64 Date UUID]) + :joyride (:import) + :org.babashka/nbb (:import) + :cljs (:import [goog.math Long]))) + +(defprotocol ToJson (-to-json [value buffer])) +--Input + +--Expected +(ns portal.runtime.cson + "Clojure/Script Object Notation" + {:no-doc true} + (:refer-clojure :exclude [read]) + (:require + #?@(:clj + [[portal.runtime.json-buffer :as json]] + + :cljr + [[portal.runtime.json-buffer :as json]] + + :cljs + [[goog.crypt.base64 :as Base64] + [portal.runtime.json-buffer :as json] + [portal.runtime.macros :as m]] + + :joyride + [[portal.runtime.json-buffer :as json] + [portal.runtime.macros :as m]] + + :org.babashka/nbb + [[portal.runtime.json-buffer :as json] + [portal.runtime.macros :as m]])) + (:import + #?@(:clj + [(java.net URL) + (java.util Base64 Date UUID)] + + :cljs + [(goog.math Long)]))) + +(defprotocol ToJson (-to-json [value buffer])) +--Expected