cljstyle
cljstyle copied to clipboard
Test bug: durations test fail on non-US fractional number formatting (ie comma vs period)
Tests shouldn't fail just by changing the locale/region of the machine they're running on.
This is output from the test suite on my macOS machine. Swedish locale is set, which formats numbers as 40,3 instead of 40.3 by default.
❯ bin/test
[(...............................................................)(..............)(.............)(........)(..................................................)(.........)(...................................)(.......................)(.............................)(...............)(.FFF.F..)(...)(..............................)(.................................................)(..........)(..........)(.............................................................................................)(..............)]
Randomized with --seed 801841687
FAIL in cljstyle.task.util-test/durations-table (util_test.clj:22)
Expected:
[{"elapsed" "1.00 ms", "percent" "100.0%", "rule" "foo", "subrule" "bar"}]
Actual:
[{"elapsed" -"1.00 ms" +"1,00 ms", "percent" -"100.0%" +"100,0%", "rule" "foo", "subrule" "bar"}]
FAIL in cljstyle.task.util-test/durations-table (util_test.clj:28)
Expected:
[{"elapsed" "4.00 ms", "percent" "80.0%", "rule" "foo", "subrule" "baz"}
{"elapsed" "1.00 ms", "percent" "20.0%", "rule" "foo", "subrule" "bar"}]
Actual:
[{"elapsed" -"4.00 ms" +"4,00 ms", "percent" -"80.0%" +"80,0%", "rule" "foo", "subrule" "baz"}
{"elapsed" -"1.00 ms" +"1,00 ms", "percent" -"20.0%" +"20,0%", "rule" "foo", "subrule" "bar"}]
FAIL in cljstyle.task.util-test/duration-formatting (util_test.clj:8)
renders durations under 100 ms as fractional milliseconds
Expected:
"3.14 ms"
Actual:
-"3.14 ms" +"3,14 ms"
FAIL in cljstyle.task.util-test/duration-formatting (util_test.clj:12)
renders durations under a minute as fractional seconds
Expected:
"18.84 sec"
Actual:
-"18.84 sec" +"18,84 sec"
72 tests, 476 assertions, 4 failures.
I'll see if I can make a PR to fix this soon.
Done: https://github.com/greglook/cljstyle/issues/113