diff --git a/lib/standard-clojure-style.js b/lib/standard-clojure-style.js index 144ba1a..590603d 100644 --- a/lib/standard-clojure-style.js +++ b/lib/standard-clojure-style.js @@ -2127,6 +2127,7 @@ } else if (idx > requireNodeIdx && insideRequireForm && isTokenNode2 && isReferKeyword(node)) { referIdx = idx referParenNestingDepth = parenNestingDepth + console.log('AAAAAAAAA') // is this :require :default ? } else if (idx > requireNodeIdx && insideRequireForm && isTokenNode2 && isDefaultKeyword(node)) { @@ -2153,6 +2154,7 @@ // collect :refer :all } else if (idx > referIdx && insideRequireForm && isTokenNode2 && isAllNode(node)) { result.requires[activeRequireIdx].refer = 'all' + console.log('BBBBBBBBBB') // collect :refer :default symbol } else if (idx > referIdx && insideRequireForm && isTokenNode2 && nextTokenIsRequireDefaultSymbol) { diff --git a/test/parse_ns.test.js b/test/parse_ns.test.js index 68d964a..91faf13 100644 --- a/test/parse_ns.test.js +++ b/test/parse_ns.test.js @@ -58,9 +58,9 @@ test('All test_parse_ns/ 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('GitHub Issue #166 - :require :refer :all bug') const ignoreSomeTests = false const ignoreTests = new Set() diff --git a/test_parse_ns/parse_ns.eno b/test_parse_ns/parse_ns.eno index fd80856..4c065e1 100644 --- a/test_parse_ns/parse_ns.eno +++ b/test_parse_ns/parse_ns.eno @@ -2916,3 +2916,30 @@ ] } --Expected + +# GitHub Issue #166 - :require :refer :all bug + +> https://github.com/oakmac/standard-clojure-style-js/issues/166 + +--Input +(ns com.example.my-app + (:require [other :refer :all :rename {foo bar}])) +--Input + +--Expected +{ + "nsSymbol": "com.example.my-app", + "requires": [ + { + "symbol": "other", + "refer": "all", + "rename": [ + { + "fromSymbol": "foo", + "toSymbol": "bar" + } + ] + } + ] +} +--Expected