Skip to content

Commit

Permalink
test_runner: tap parser
Browse files Browse the repository at this point in the history
fix missing leading whitespaces in YAML content
  • Loading branch information
manekinekko committed Jun 21, 2022
1 parent 12fc364 commit c26836f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/internal/test_runner/tap_lexer.js
Expand Up @@ -342,7 +342,6 @@ class TapLexer {
break;
}

// Note: we might consume a dot
char = this.next();
yaml += char;

Expand All @@ -360,7 +359,7 @@ class TapLexer {

return new Token({
type: TokenKind.TAP_YAML,
value: yaml.trim(),
value: yaml, // don't trim on purpose!
stream: this.source,
});
}
Expand Down
40 changes: 39 additions & 1 deletion lib/internal/test_runner/tap_parser_test.js
Expand Up @@ -4,7 +4,7 @@ const util = require('util');
const { TapParser } = require('./tap_parser');

function TAP(input) {
const parser = new TapParser(input, {debug: false});
const parser = new TapParser(input, {debug: true});
const ast = parser.parse();

console.log(`s------------------------------`);
Expand Down Expand Up @@ -341,3 +341,41 @@ TAP(`
TAP version 14
1..0 # skip because English-to-French translator isn't installed
`);

TAP(`
TAP version 14
1..4
ok 1 - Creating test program
ok 2 - Test program runs, no error
not ok 3 - infinite loop # TODO halting problem unsolved
not ok 4 - infinite loop 2 # TODO halting problem unsolved
`);

TAP(`
TAP version 14
ok - created Board
ok
ok
ok
ok
ok
ok
ok
---
message: "Board layout"
severity: comment
dump:
board:
- ' 16G 05C '
- ' G N C C C G '
- ' G C + '
- '10C 01G 03C '
- 'R N G G A G C C C '
- ' R G C + '
- ' 01G 17C 00C '
- ' G A G G N R R N R '
- ' G R G '
...
ok - board has 7 tiles + starter tile
1..9
`);

0 comments on commit c26836f

Please sign in to comment.