Skip to content

Commit 95c9422

Browse files
authored
Merge pull request #54 from mhansen/master
Add rudimentary tests for cljParser.getNamespace
2 parents a77f59f + bb119c5 commit 95c9422

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

test/cljParser.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import * as assert from 'assert';
2+
import {cljParser} from '../src/cljParser';
3+
4+
suite('cljParser', () => {
5+
let cases = [
6+
['user', ''],
7+
['foo', '(ns foo)'],
8+
['foo', '\n(ns foo)'],
9+
['foo', '\t(ns foo)'],
10+
['foo', '\t(ns\tfoo)'],
11+
['foo-bar', '(ns foo-bar)'],
12+
['bar', '(ns bar)'],
13+
['baz', '(ns baz "docstring")'],
14+
['qux', `(ns qux
15+
"docstring")`],
16+
['foo.bar', '(ns foo.bar)'],
17+
['foo.bar-baz', '(ns foo.bar-baz)'],
18+
['foo.bar', `(ns foo.bar
19+
(:refer-clojure :exclude [ancestors printf])
20+
(:require (clojure.contrib sql combinatorics))
21+
(:use (my.lib this that))
22+
(:import (java.util Date Timer Random)
23+
(java.sql Connection Statement)))`],
24+
['bar', '(in-ns \'bar)'],
25+
];
26+
for (let [want, input] of cases) {
27+
test(`getNamespace("${input}") should be "${want}"`, () => {
28+
assert.equal(cljParser.getNamespace(input), want);
29+
});
30+
}
31+
});

0 commit comments

Comments
 (0)