fix: clojure test suite compatibility — 145/225 passing (64%)
Reader: #? reader conditionals with :default, #?@ splicing, char literals, N/M suffix and ratio parsing, comma as whitespace, number parsing fix for negative BigInt/Decimal/Ratio literals Emitter: mangleName trailing/double underscore fixes, scope stack for local var tracking, symbol-as-value emits cljSymbol() not bare identifier, macro-expanded do-unwrap in processForm, emitBlock multiline wrap, indentCode helper, when-var-exists emitter form, variadic apply fix, fn proc spacing fix, def indent fix Macros: deftest, is, testing, thrown?, are, when-var-exists builtins; rewritten and/or using gensym; improved for/doseq/dotimes; cond-> and cond->> threading fixes; threading macro insert fixes Runtime: sorted-map, sorted-set, sorted?, array-map, object-array, hash-map, hash-set, inf, nan; assoc extended to vectors Test runner: #?@ splice unwrapping, removed conflicting defmacro stubs
This commit is contained in:
+6
-5
@@ -44,13 +44,16 @@ def extract_default(content, start):
|
||||
return rest[:k], k
|
||||
|
||||
def strip_reader_conditionals(text):
|
||||
"""Strip #? and #?@ reader conditionals, keeping :default branch content."""
|
||||
"""Strip #? and #?@ reader conditionals, keeping :default branch content.
|
||||
For #?@, if the default is a vector/list, unwrap it (splice semantics)."""
|
||||
result = []
|
||||
i = 0
|
||||
while i < len(text):
|
||||
# Check for #?@ or #?
|
||||
is_splice = False
|
||||
if i + 3 <= len(text) and text[i:i+3] == '#?@':
|
||||
j = i + 3
|
||||
is_splice = True
|
||||
elif i + 2 <= len(text) and text[i:i+2] == '#?':
|
||||
j = i + 2
|
||||
else:
|
||||
@@ -85,6 +88,8 @@ def strip_reader_conditionals(text):
|
||||
# Extract content between parens
|
||||
inner = text[j+1:k]
|
||||
default_val, _ = extract_default(inner, 0)
|
||||
if is_splice and len(default_val) >= 2 and default_val[0] in '([':
|
||||
default_val = default_val[1:-1]
|
||||
result.append(default_val)
|
||||
i = k + 1
|
||||
|
||||
@@ -98,10 +103,6 @@ def run_test(cljc_path, timeout=30):
|
||||
content = re.sub(r'#\{[^}]*\}', r'@[]', content) # #{} → @[]
|
||||
content = re.sub(r'#:([\w-]+)', r'\1', content) # #:foo → foo
|
||||
stubs = '''(do
|
||||
(defmacro is [form] (list 'quote form))
|
||||
(defmacro testing [desc & body] (cons 'do body))
|
||||
(defmacro thrown? [form] (list 'try form false (list 'catch 'Exception 'e true)))
|
||||
(defmacro deftest [name & body] (list 'def name (cons 'fn (cons [] body))))
|
||||
'''
|
||||
content = stubs + content + ')'
|
||||
content = re.sub(r'clojure\.test', 'test', content)
|
||||
|
||||
Reference in New Issue
Block a user