jscert / jsexplain

Apache License 2.0
26 stars 4 forks source link

[MyNoobEnv] calc.ml generate tests fail #29

Closed barockobamo closed 5 years ago

barockobamo commented 5 years ago

Here is one of my stange issue :

~/git/jsexplain/generator/tests$ ../../node_modules/mocha/bin/mocha calc.unlog.as.js 

  calc.ml
    1) is_empty
    ✓ push
    2) pop
    3) run
    ✓ mapMystack

  2 passing (7ms)
  3 failing

  1) calc.ml
       is_empty:
     TypeError: _compare_stack is not a function
      at is_empty (calc.unlog.as.js:231:11)
      at /home/sam/git/jsexplain/generator/tests/calc.unlog.as.js:313:19
      at Context.<anonymous> (calc.unlog.as.js:207:5)

  2) calc.ml
       pop:
     TypeError: expected.test is not a function
      at expectedException (assert.js:605:21)
      at innerThrows (assert.js:648:21)
      at Object.throws (assert.js:662:3)
      at Object.Mocha.assert_failwith (calc.unlog.as.js:214:44)
      at /home/sam/git/jsexplain/generator/tests/calc.unlog.as.js:328:11
      at Context.<anonymous> (calc.unlog.as.js:207:5)

  3) calc.ml
       run:
     TypeError: expected.test is not a function
      at expectedException (assert.js:605:21)
      at innerThrows (assert.js:648:21)
      at Object.throws (assert.js:662:3)
      at Object.Mocha.assert_failwith (calc.unlog.as.js:214:44)
      at /home/sam/git/jsexplain/generator/tests/calc.unlog.as.js:345:11
      at Context.<anonymous> (calc.unlog.as.js:207:5)

Here is a part of the code in calc.unlog.as.js :

/* --------------------- Compare.js --------------------- */
const _compare_stack = _compare_generic;
/* --------------------- calc.unlog.js --------------------- */

var Calc = (function() {
with (Mocha) {

function C(value, stack) { return {tag: "C", value: value, stack: stack}; }

function N() { return {tag: "N" }; }

var is_empty = function (s) {
  return (_compare_stack(s, N()));
};

And it's true that __comparestack is not a function. Alan was passing the test this morning but i still don't understand why i have this one. Maybe it is still my configuration which is not in place ...

IgnoredAmbience commented 5 years ago

When I build calc.unlog.as.js, the relevant section of included code for Compare.js is:

/* --------------------- Compare.js --------------------- */

const _compare_generic = require('util').isDeepStrictEqual;
const _compare_stack = _compare_generic;

/* --------------------- calc.unlog.js --------------------- */

I'm not sure why you've got different results.

barockobamo commented 5 years ago

Sorry, i do have the same code, i removed it without realizing that it was relevant for the issue. But it still fail, i will continue to investigate.

brabalan commented 5 years ago

Could it be the require('util') bit? You could try running it in node.

IgnoredAmbience commented 5 years ago

What node version do you have installed? node --version or nodejs --version will give this to you.

barockobamo commented 5 years ago

$ node -v v8.11.4

brabalan commented 5 years ago

I think it's too old. Could you try launching it and doing require('util') in it? You'll then see if it has the function isDeepStrictEqual.

IgnoredAmbience commented 5 years ago

Yes, Util.isDeepStrictEqual was introduced to Node v9. I had intended that we should be compatible with the Node LTS release, which is currently the 8.x versions (most recent is 8.12, last tested with 8.11). So the fault is me leaving the intended version requirements.