caolan / caolan/nodeunit

String cutoff error, prevents passing test

Aperta
#196 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
1.9k
Fork
359
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I apologize if this a quite obvious mistake on my part, but I have been staring at this for an hour. I don't know how this could possibly be a bug on your end, but it's worth a try.

The following test does not pass:

``` javascript
exports.testWhile = function(test){
test.expect(1);

var input = parseSingleStat("while(foo() < 1){bar();}");
var output = parse("var __t0 = foo(); while(__t0 < 1){bar(); var __t0 = foo(); }");

test.equal(deparse(output), deparse(tacifyFunctions.tacifyWhile(input)));

test.done();

}
```

The following test passes:

``` javascript
exports.testWhile = function(test){
test.expect(1);

var input = parseSingleStat("while(foo() < 1){bar();}");
var output = parse("var __t0 = foo(); while(__t0 < 1){bar(); var __t0 = foo(); }");
var e = deparse(output);
var o = deparse(tacifyFunctions.tacifyWhile(input));

test.equal(e, o);

test.done();

}
```

deparse returns a string. In the former case deparse(tacifyFunctions.tacifyWhile(input)) is returning a string

Here is output from the test

tests
✔ testNested
✖ testWhile

`AssertionError: 'var __t0 = foo();\n\nwhile (__t0 < 1) {\n bar();\n var __t0 = foo();\n}' == 'while (__t0 < 1) {\n bar();\n var __t0 = foo();\n}'`
at Object.assertWrapper [as equal](/usr/lib/node_modules/nodeunit/lib/types.js:83:39)
at Object.exports.testWhile (/home/satshabad/CS/CS585/jaspect/tests/tests.js:53:8)
at Object.wrapTest (/usr/lib/node_modules/nodeunit/lib/core.js:235:16)
at wrapTest (/usr/lib/node_modules/nodeunit/lib/core.js:235:16)
at Object.exports.runTest (/usr/lib/node_modules/nodeunit/lib/core.js:69:9)
at exports.runSuite (/usr/lib/node_modules/nodeunit/lib/core.js:117:25)
at _concat (/usr/lib/node_modules/nodeunit/deps/async.js:508:13)
at async.forEachSeries.iterate (/usr/lib/node_modules/nodeunit/deps/async.js:118:13)
at async.forEachSeries.iterate (/usr/lib/node_modules/nodeunit/deps/async.js:129:25)
at _concat (/usr/lib/node_modules/nodeunit/deps/async.js:510:17)

FAILURES: 1/5 assertions failed (38ms)

I would appreciate any insight.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Leggi tests/tests.js in corrispondenza di testWhile ed esegui il test segnalato per riprodurre il fallimento. Confronta le due chiamate a deparse con le stringhe prevista ed effettiva mostrate; il lavoro è completato quando si identifica la causa e si conferma una correzione mirata con un test superato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, node.js
Ambito
testing
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
20/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.