File tree Expand file tree Collapse file tree 4 files changed +45
-6
lines changed Expand file tree Collapse file tree 4 files changed +45
-6
lines changed Original file line number Diff line number Diff line change 364
364
; ; File, Line, and Column Helpers
365
365
366
366
(defn js-line-and-column [stack-element]
367
+ " Returns a 2-element vector containing the line and
368
+ column encoded at the end of a stack element string.
369
+ A line or column will be represented as NaN if not
370
+ parsesable."
367
371
(let [parts (.split stack-element " :" )
368
372
cnt (count parts)]
369
- [(js/parseInt (nth parts (- cnt 2 )) 10 )
370
- (js/parseInt (nth parts (dec cnt)) 10 )]))
373
+ (if (> cnt 1 )
374
+ [(js/parseInt (nth parts (- cnt 2 )) 10 )
375
+ (js/parseInt (nth parts (dec cnt)) 10 )]
376
+ [NaN NaN])))
371
377
372
378
(defn js-filename [stack-element]
373
379
(first (.split (last (.split stack-element " /out/" )) " :" )))
Original file line number Diff line number Diff line change
1
+ (ns cljs.test-test
2
+ (:require [cljs.test :refer-macros [deftest testing is] :as ct]
3
+ [clojure.string :as s]
4
+ [clojure.set :as set]))
5
+
6
+ (defn- nan?
7
+ [x]
8
+ (and (number? x)
9
+ (js/isNaN x)))
10
+
11
+ (deftest js-line-and-column-test
12
+ (is (= [2 3 ] (ct/js-line-and-column " foo:bar:2:3" )))
13
+ (is (= [2 3 ] (ct/js-line-and-column " foo:2:3" )))
14
+ (is (= [2 3 ] (ct/js-line-and-column " 2:3" )))
15
+ (let [[line column] (ct/js-line-and-column " foo:bogus:3" )]
16
+ (is (nan? line))
17
+ (is (== 3 column)))
18
+ (let [[line column] (ct/js-line-and-column " foo:2:bogus" )]
19
+ (is (== 2 line))
20
+ (is (nan? column)))
21
+ (let [[line column] (ct/js-line-and-column " foo:bogus:bogus" )]
22
+ (is (nan? line))
23
+ (is (nan? column)))
24
+ (let [[line column] (ct/js-line-and-column " foo:3" )]
25
+ (is (nan? line))
26
+ (is (== 3 column)))
27
+ (let [[line column] (ct/js-line-and-column " foo" )]
28
+ (is (nan? line))
29
+ (is (nan? column))))
Original file line number Diff line number Diff line change 38
38
[cljs.clojure-alias-test]
39
39
[cljs.hash-map-test]
40
40
[cljs.predicates-test]
41
- [cljs.tagged-literals-test]))
41
+ [cljs.tagged-literals-test]
42
+ [cljs.test-test]))
42
43
43
44
(set! *print-newline* false )
44
45
(set-print-fn! js/print)
74
75
'cljs.pprint-test
75
76
'cljs.predicates-test
76
77
'cljs.syntax-quote-test
77
- 'cljs.tagged-literals-test)
78
+ 'cljs.tagged-literals-test
79
+ 'cljs.test-test)
Original file line number Diff line number Diff line change 280
280
[cljs.clojure-alias-test]
281
281
[cljs.hash-map-test]
282
282
[cljs.syntax-quote-test]
283
- [cljs.predicates-test]))
283
+ [cljs.predicates-test]
284
+ [cljs.test-test]))
284
285
(fn [{:keys [value error]}]
285
286
(if error
286
287
(prn error)
315
316
'cljs.clojure-alias-test
316
317
'cljs.hash-map-test
317
318
'cljs.syntax-quote-test
318
- 'cljs.predicates-test)
319
+ 'cljs.predicates-test
320
+ 'cljs.test-test)
319
321
(fn [{:keys [value error]}]
320
322
(when error
321
323
(prn error)))))))))
You can’t perform that action at this time.
0 commit comments