Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions test/clojure/core_test/special_symbol_qmark.cljc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
(ns clojure.core-test.special-symbol-qmark
(:require [clojure.test :refer [deftest testing are]]
[clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists]]))

(when-var-exists special-symbol?
(deftest test-special-symbol?

(testing "special symbols"
(are [arg] (special-symbol? 'arg)
&
.
case*
catch
def
deftype*
do
finally
fn*
if
let*
letfn*
loop*
new
quote
recur
set!
throw
try
var))

(testing "more special symbols"
#?(:cljs "cljs doesn't have these"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeaye would it be better to use when-var-defined for all of these or the current approach? If I understand correctly cljs simply doesn't have these symbols defined at all, not that it has them defined but as non special symbols

:default (are [arg] (special-symbol? 'arg)
clojure.core/import*
monitor-enter
monitor-exit
reify*)))

(testing "not special symbols"
(are [arg] (not (special-symbol? arg))
'a-symbol
'a-ns/a-qualified-symbol
'defn
'import
"not a symbol"
:k
0
0.0
true
false
nil))))