gkz / prelude-ls

prelude.ls is a functionally oriented utility library - powerful and flexible, almost all of functions are curried. It is written in, and is the recommended base library for, http://livescript.net
http://preludels.com/
MIT License
424 stars 57 forks source link

Tests failure #116

Closed guimard closed 4 years ago

guimard commented 5 years ago

Hello,

test fails (below report using mocha -R spec) :

  437 passing (296ms)
  2 failing

  1) negate
       zero:

      AssertionError [ERR_ASSERTION]: Input A expected to strictly equal input B:
+ expected - actual                                                                                                                                              

- 0
+ -0
      + expected - actual

      -0
      +-0

      at Context.<anonymous> (test/Num.ls:35:12)
      at callFn (/usr/lib/nodejs/mocha/lib/runnable.js:354:21)
      at Test.Runnable.run (/usr/lib/nodejs/mocha/lib/runnable.js:346:7)
      at Runner.runTest (/usr/lib/nodejs/mocha/lib/runner.js:442:10)
      at /usr/lib/nodejs/mocha/lib/runner.js:560:12
      at next (/usr/lib/nodejs/mocha/lib/runner.js:356:14)
      at /usr/lib/nodejs/mocha/lib/runner.js:366:7
      at next (/usr/lib/nodejs/mocha/lib/runner.js:290:14)
      at Immediate._onImmediate (/usr/lib/nodejs/mocha/lib/runner.js:334:5)

  2) ceiling
       negative number:

      AssertionError [ERR_ASSERTION]: Input A expected to strictly equal input B:
+ expected - actual

- 0
+ -0
      + expected - actual

      -0
      +-0

      at Context.<anonymous> (test/Num.ls:236:12)
      at callFn (/usr/lib/nodejs/mocha/lib/runnable.js:354:21)
      at Test.Runnable.run (/usr/lib/nodejs/mocha/lib/runnable.js:346:7)
      at Runner.runTest (/usr/lib/nodejs/mocha/lib/runner.js:442:10)
      at /usr/lib/nodejs/mocha/lib/runner.js:560:12
      at next (/usr/lib/nodejs/mocha/lib/runner.js:356:14)
      at /usr/lib/nodejs/mocha/lib/runner.js:366:7
      at next (/usr/lib/nodejs/mocha/lib/runner.js:290:14)
      at Immediate._onImmediate (/usr/lib/nodejs/mocha/lib/runner.js:334:5)

I had to disable 2 tests:

--- a/test/Num.ls
+++ b/test/Num.ls
@@ -30,9 +30,6 @@
     eq 0, f 0

 suite 'negate' ->
-  test 'zero' ->
-    eq 0, negate 0
-
   test 'negative number' ->
     eq -2, negate 2

@@ -202,9 +199,6 @@
   test 'positive number' ->
     eq 1, ceiling 0.1

-  test 'negative number' ->
-    eq 0, ceiling -0.9
-
 suite 'floor' ->
   test 'zero' ->
     eq 0, floor 0
anko commented 5 years ago

JS has had negative zero (-0) for a long time, so I'm a little puzzled why this test is only failing now. I guess Mocha got an update so eq now sees -0 and +0 as distinct.

guimard commented 4 years ago

Hi, 2 other tests fail with Node.js ≥ 12:

anko commented 4 years ago

Documenting for posterity: Tests now pass; fixed in https://github.com/gkz/prelude-ls/compare/c34e273fe9948f2880b065a9a22b1702663b4fe9...d4052990d13eb5adf9a3cc6ca339c6d4bcd49740. Thanks @gkz!