Skip to content

Commit

Permalink
add cljs.analyzer ns test case
Browse files Browse the repository at this point in the history
  • Loading branch information
oakmac committed Oct 19, 2024
1 parent d663c09 commit 6d6d85b
Show file tree
Hide file tree
Showing 2 changed files with 382 additions and 0 deletions.
105 changes: 105 additions & 0 deletions test_format/ns.eno
Original file line number Diff line number Diff line change
Expand Up @@ -1485,3 +1485,108 @@
(:require
[clojure.string]))
--Expected

# cljs.analyzer example

> https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/analyzer.cljc

--Input
(ns cljs.analyzer
#?(:clj (:refer-clojure :exclude [ensure macroexpand-1])
:cljs (:refer-clojure :exclude [ensure js-reserved macroexpand-1 ns-interns]))
#?(:cljs (:require-macros [cljs.analyzer.macros
:refer [allowing-redef disallowing-ns* disallowing-recur
no-warn with-warning-handlers wrapping-errors]]
[cljs.env.macros :refer [ensure]]))
#?(:clj (:require [cljs.analyzer.impl :as impl]
[cljs.analyzer.impl.namespaces :as nses]
[cljs.analyzer.passes.and-or :as and-or]
[cljs.env :as env :refer [ensure]]
[cljs.externs :as externs]
[cljs.js-deps :as deps]
[cljs.tagged-literals :as tags]
[cljs.util :as util :refer [ns->relpath topo-sort]]
[clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.set :as set]
[clojure.string :as string]
[cljs.vendor.clojure.tools.reader :as reader]
[cljs.vendor.clojure.tools.reader.reader-types :as readers])
:cljs (:require [cljs.analyzer.impl :as impl]
[cljs.analyzer.impl.namespaces :as nses]
[cljs.analyzer.passes.and-or :as and-or]
[cljs.env :as env]
[cljs.reader :as edn]
[cljs.tagged-literals :as tags]
[cljs.tools.reader :as reader]
[cljs.tools.reader.reader-types :as readers]
[clojure.set :as set]
[clojure.string :as string]
[goog.string :as gstring]))
#?(:clj (:import [cljs.tagged_literals JSValue]
[clojure.lang Namespace Var LazySeq ArityException]
[java.io File Reader PushbackReader]
[java.lang Throwable]
[java.net URL]
[java.util.regex Pattern])))

#?(:clj (set! *warn-on-reflection* true))

;; User file-local compiler flags
#?(:clj (def ^:dynamic *unchecked-if* false))
#?(:clj (def ^:dynamic *unchecked-arrays* false))
--Input

--Expected
(ns cljs.analyzer
(:refer-clojure
:exclude #?@(:clj [ensure macroexpand-1]
:cljs [ensure js-reserved macroexpand-1 ns-interns]))
#?(:cljs
(:require-macros
[cljs.analyzer.macros :refer [allowing-redef disallowing-ns* disallowing-recur no-warn with-warning-handlers wrapping-errors]]
[cljs.env.macros :refer [ensure]]))
(:require
#?@(:clj
[[cljs.analyzer.impl :as impl]
[cljs.analyzer.impl.namespaces :as nses]
[cljs.analyzer.passes.and-or :as and-or]
[cljs.env :as env :refer [ensure]]
[cljs.externs :as externs]
[cljs.js-deps :as deps]
[cljs.tagged-literals :as tags]
[cljs.util :as util :refer [ns->relpath topo-sort]]
[cljs.vendor.clojure.tools.reader :as reader]
[cljs.vendor.clojure.tools.reader.reader-types :as readers]
[clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.set :as set]
[clojure.string :as string]]

:cljs
[[cljs.analyzer.impl :as impl]
[cljs.analyzer.impl.namespaces :as nses]
[cljs.analyzer.passes.and-or :as and-or]
[cljs.env :as env]
[cljs.reader :as edn]
[cljs.tagged-literals :as tags]
[cljs.tools.reader :as reader]
[cljs.tools.reader.reader-types :as readers]
[clojure.set :as set]
[clojure.string :as string]
[goog.string :as gstring]]))
#?(:clj
(:import
(cljs.tagged_literals JSValue)
(clojure.lang ArityException LazySeq Namespace Var)
(java.io File PushbackReader Reader)
(java.lang Throwable)
(java.net URL)
(java.util.regex Pattern))))

#?(:clj (set! *warn-on-reflection* true))

;; User file-local compiler flags
#?(:clj (def ^:dynamic *unchecked-if* false))
#?(:clj (def ^:dynamic *unchecked-arrays* false))
--Expected
277 changes: 277 additions & 0 deletions test_parse_ns/parse_ns.eno
Original file line number Diff line number Diff line change
Expand Up @@ -2198,3 +2198,280 @@
]
}
--Expected

# cljs.analyzer example

> https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/analyzer.cljc

--Input
(ns cljs.analyzer
#?(:clj (:refer-clojure :exclude [ensure macroexpand-1])
:cljs (:refer-clojure :exclude [ensure js-reserved macroexpand-1 ns-interns]))
#?(:cljs (:require-macros [cljs.analyzer.macros
:refer [allowing-redef disallowing-ns* disallowing-recur
no-warn with-warning-handlers wrapping-errors]]
[cljs.env.macros :refer [ensure]]))
#?(:clj (:require [cljs.analyzer.impl :as impl]
[cljs.analyzer.impl.namespaces :as nses]
[cljs.analyzer.passes.and-or :as and-or]
[cljs.env :as env :refer [ensure]]
[cljs.externs :as externs]
[cljs.js-deps :as deps]
[cljs.tagged-literals :as tags]
[cljs.util :as util :refer [ns->relpath topo-sort]]
[clojure.edn :as edn]
[clojure.java.io :as io]
[clojure.set :as set]
[clojure.string :as string]
[cljs.vendor.clojure.tools.reader :as reader]
[cljs.vendor.clojure.tools.reader.reader-types :as readers])
:cljs (:require [cljs.analyzer.impl :as impl]
[cljs.analyzer.impl.namespaces :as nses]
[cljs.analyzer.passes.and-or :as and-or]
[cljs.env :as env]
[cljs.reader :as edn]
[cljs.tagged-literals :as tags]
[cljs.tools.reader :as reader]
[cljs.tools.reader.reader-types :as readers]
[clojure.set :as set]
[clojure.string :as string]
[goog.string :as gstring]))
#?(:clj (:import [cljs.tagged_literals JSValue]
[clojure.lang Namespace Var LazySeq ArityException]
[java.io File Reader PushbackReader]
[java.lang Throwable]
[java.net URL]
[java.util.regex Pattern])))

#?(:clj (set! *warn-on-reflection* true))

;; User file-local compiler flags
#?(:clj (def ^:dynamic *unchecked-if* false))
#?(:clj (def ^:dynamic *unchecked-arrays* false))
--Input

--Expected
{
"nsSymbol": "cljs.analyzer",
"referClojure": {
"exclude": [
{ "symbol": "ensure","platform": ":clj" },
{ "symbol": "ensure","platform": ":cljs" },
{ "symbol": "js-reserved","platform": ":cljs" },
{ "symbol": "macroexpand-1","platform": ":clj" },
{ "symbol": "macroexpand-1","platform": ":cljs" },
{ "symbol": "ns-interns","platform": ":cljs" }
]
},
"requireMacros": [
{
"symbol": "cljs.analyzer.macros",
"platform": ":cljs",
"refer": [
{ "symbol": "allowing-redef", "platform": ":cljs" },
{ "symbol": "disallowing-ns*", "platform": ":cljs" },
{ "symbol": "disallowing-recur", "platform": ":cljs" },
{ "symbol": "no-warn", "platform": ":cljs" },
{ "symbol": "with-warning-handlers", "platform": ":cljs" },
{ "symbol": "wrapping-errors", "platform": ":cljs" }
]
},
{
"symbol": "cljs.env.macros",
"platform": ":cljs",
"refer": [
{ "symbol": "ensure", "platform": ":cljs" }
]
}
],
"requires": [
{
"symbol": "cljs.analyzer.impl",
"platform": ":clj",
"as": "impl"
},
{
"symbol": "cljs.analyzer.impl",
"platform": ":cljs",
"as": "impl"
},
{
"symbol": "cljs.analyzer.impl.namespaces",
"platform": ":clj",
"as": "nses"
},
{
"symbol": "cljs.analyzer.impl.namespaces",
"platform": ":cljs",
"as": "nses"
},
{
"symbol": "cljs.analyzer.passes.and-or",
"platform": ":clj",
"as": "and-or"
},
{
"symbol": "cljs.analyzer.passes.and-or",
"platform": ":cljs",
"as": "and-or"
},
{
"symbol": "cljs.env",
"platform": ":clj",
"as": "env",
"refer": [
{
"symbol": "ensure"
}
]
},
{
"symbol": "cljs.env",
"platform": ":cljs",
"as": "env"
},
{
"symbol": "cljs.externs",
"platform": ":clj",
"as": "externs"
},
{
"symbol": "cljs.js-deps",
"platform": ":clj",
"as": "deps"
},
{
"symbol": "cljs.reader",
"platform": ":cljs",
"as": "edn"
},
{
"symbol": "cljs.tagged-literals",
"platform": ":clj",
"as": "tags"
},
{
"symbol": "cljs.tagged-literals",
"platform": ":cljs",
"as": "tags"
},
{
"symbol": "cljs.tools.reader",
"platform": ":cljs",
"as": "reader"
},
{
"symbol": "cljs.tools.reader.reader-types",
"platform": ":cljs",
"as": "readers"
},
{
"symbol": "cljs.util",
"platform": ":clj",
"as": "util",
"refer": [
{
"symbol": "ns->relpath"
},
{
"symbol": "topo-sort"
}
]
},
{
"symbol": "cljs.vendor.clojure.tools.reader",
"platform": ":clj",
"as": "reader"
},
{
"symbol": "cljs.vendor.clojure.tools.reader.reader-types",
"platform": ":clj",
"as": "readers"
},
{
"symbol": "clojure.edn",
"platform": ":clj",
"as": "edn"
},
{
"symbol": "clojure.java.io",
"platform": ":clj",
"as": "io"
},
{
"symbol": "clojure.set",
"platform": ":clj",
"as": "set"
},
{
"symbol": "clojure.set",
"platform": ":cljs",
"as": "set"
},
{
"symbol": "clojure.string",
"platform": ":clj",
"as": "string"
},
{
"symbol": "clojure.string",
"platform": ":cljs",
"as": "string"
},
{
"symbol": "goog.string",
"platform": ":cljs",
"as": "gstring"
}
],
"imports": [
{
"package": "cljs.tagged_literals",
"classes": [
"JSValue"
],
"platform": ":clj"
},
{
"package": "clojure.lang",
"classes": [
"ArityException",
"LazySeq",
"Namespace",
"Var"
],
"platform": ":clj"
},
{
"package": "java.io",
"classes": [
"File",
"PushbackReader",
"Reader"
],
"platform": ":clj"
},
{
"package": "java.lang",
"classes": [
"Throwable"
],
"platform": ":clj"
},
{
"package": "java.net",
"classes": [
"URL"
],
"platform": ":clj"
},
{
"package": "java.util.regex",
"classes": [
"Pattern"
],
"platform": ":clj"
}
]
}
--Expected

0 comments on commit 6d6d85b

Please sign in to comment.