File tree Expand file tree Collapse file tree 5 files changed +65
-3
lines changed
examples/lein/src/tests/devtools_sample/tests
test/src/tests/devtools/tests Expand file tree Collapse file tree 5 files changed +65
-3
lines changed Original file line number Diff line number Diff line change
1
+ (ns devtools-sample.tests.issue54
2
+ (:require-macros [devtools-sample.logging :refer [log info]])
3
+ (:require [devtools-sample.boot :refer [boot!]]))
4
+
5
+ (boot! " /src/tests/devtools_sample/tests/issue54.cljs" )
6
+
7
+ (enable-console-print! )
8
+
9
+ ; --- MEAT STARTS HERE -->
10
+ (js/console.log ##NaN ##Inf ##-Inf )
11
+ (js/console.log [##NaN ##Inf ##-Inf ])
12
+
13
+ ; <-- MEAT STOPS HERE ---
Original file line number Diff line number Diff line change 27
27
:keyword [136 19 145 ]
28
28
:integer [28 0 207 ]
29
29
:float [28 136 207 ]
30
+ :float-nan [213 60 27 ]
31
+ :float-infinity [28 80 207 ]
30
32
:string [196 26 22 ]
31
33
:expanded-string [255 100 100 ]
32
34
:symbol [0 0 0 ]
Original file line number Diff line number Diff line change 153
153
:symbol-tag [:span :symbol-style ]
154
154
:integer-tag [:span :integer-style ]
155
155
:float-tag [:span :float-style ]
156
+ :float-nan-tag [:span :float-nan-style ]
157
+ :float-infinity-tag [:span :float-infinity-style ]
156
158
:string-tag [:span :string-style ]
157
159
:expanded-string-tag [:span :expanded-string-style ]
158
160
:circular-reference-tag [:span :circular-reference-wrapper-style ]
246
248
:keyword-style (css (str " color: " (named-color :keyword ) " ;" ))
247
249
:integer-style (css (str " color: " (named-color :integer ) " ;" ))
248
250
:float-style (css (str " color: " (named-color :float ) " ;" ))
251
+ :float-nan-style (css (str " color: " (named-color :float-nan ) " ;" ))
252
+ :float-infinity-style (css (str " color: " (named-color :float-infinity ) " ;" ))
249
253
:string-style (css (str " color: " (named-color :string ) " ;" ))
250
254
:symbol-style (css (str " color: " (named-color :symbol ) " ;" ))
251
255
:bool-style (css (str " color: " (named-color :bool ) " ;" ))
Original file line number Diff line number Diff line change 79
79
[:symbol-tag (str symbol)])
80
80
81
81
(defn <number> [number]
82
- (if (integer? number)
83
- [:integer-tag number]
84
- [:float-tag number]))
82
+ (if (js/isFinite number)
83
+ (if (integer? number)
84
+ [:integer-tag number]
85
+ [:float-tag number])
86
+ (if (js/isNaN number)
87
+ [:float-nan-tag (pr-str number)]
88
+ [:float-infinity-tag (pr-str number)])))
85
89
86
90
; -- string markup ----------------------------------------------------------------------------------------------------------
87
91
Original file line number Diff line number Diff line change 1031
1031
[:meta-body-tag
1032
1032
[:header-tag
1033
1033
CIRCULAR]]))))))))
1034
+
1035
+ (deftest test-issue-54
1036
+ (testing " properly handle ##NaN and ##Inf"
1037
+ (let [nan ##NaN
1038
+ wrapped-nan [##NaN ]
1039
+ p-inf ##Inf
1040
+ n-inf ##-Inf
1041
+ wrapped-infs [##Inf ##-Inf ]]
1042
+ (is-header nan
1043
+ [:cljs-land-tag
1044
+ [:header-tag
1045
+ [:float-nan-tag " ##NaN" ]]])
1046
+ (has-body? nan false )
1047
+ (is-header wrapped-nan
1048
+ [:cljs-land-tag
1049
+ [:header-tag
1050
+ " ["
1051
+ [:float-nan-tag " ##NaN" ]
1052
+ " ]" ]])
1053
+ (has-body? wrapped-nan false )
1054
+ (is-header p-inf
1055
+ [:cljs-land-tag
1056
+ [:header-tag
1057
+ [:float-infinity-tag " ##Inf" ]]])
1058
+ (has-body? p-inf false )
1059
+ (is-header n-inf
1060
+ [:cljs-land-tag
1061
+ [:header-tag
1062
+ [:float-infinity-tag " ##-Inf" ]]])
1063
+ (has-body? n-inf false )
1064
+ (is-header wrapped-infs
1065
+ [:cljs-land-tag
1066
+ [:header-tag
1067
+ " ["
1068
+ [:float-infinity-tag " ##Inf" ]
1069
+ :spacer
1070
+ [:float-infinity-tag " ##-Inf" ]
1071
+ " ]" ]])
1072
+ (has-body? wrapped-infs false ))))
You can’t perform that action at this time.
0 commit comments