From 0dbc466a4632e55826690ad22e361685538bf18d Mon Sep 17 00:00:00 2001 From: Andy Brenneke Date: Tue, 21 Feb 2017 00:39:31 -0800 Subject: [PATCH] Add tests for YAML indented more than two spaces --- test/fixtures/yaml-indented-more.txt | 11 +++++++++++ test/observable.js | 21 +++++++++++++++++++++ test/stream.js | 21 +++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 test/fixtures/yaml-indented-more.txt diff --git a/test/fixtures/yaml-indented-more.txt b/test/fixtures/yaml-indented-more.txt new file mode 100644 index 0000000..61cb989 --- /dev/null +++ b/test/fixtures/yaml-indented-more.txt @@ -0,0 +1,11 @@ +TAP version 13 +# test 1 +not ok 1 indented more than two spaces + --- + a: b + ... + +1..1 +# tests 1 +# pass 0 +# fail 1 diff --git a/test/observable.js b/test/observable.js index 17703dc..8091285 100644 --- a/test/observable.js +++ b/test/observable.js @@ -271,6 +271,22 @@ test('parses result values', function (t) { } }) +test('parses yaml indented more in failing assertions', function (t) { + + t.plan(1) + + return function (done) { + + tapOut.observeStream(fixtureStream('yaml-indented-more')).failingAssertions$ + .forEach(function (assertion) { + + t.deepEqual(assertion.diagnostic, { + a: 'b' + }, 'parsed yaml block') + }) + } +}) + // Helpers function yamlTapStream () { @@ -283,6 +299,11 @@ function basicTapStream () { return fs.createReadStream(__dirname + '/fixtures/basic.txt') } +function fixtureStream (name) { + + return fs.createReadStream(__dirname + '/fixtures/' + name + '.txt') +} + function filterTypeInObservable$ (stream, type) { return tapOut.observeStream(stream) diff --git a/test/stream.js b/test/stream.js index 9224513..ec0f9e1 100644 --- a/test/stream.js +++ b/test/stream.js @@ -261,6 +261,22 @@ test('parses result values', function (t) { } }) +test('parses yaml indented more in failing assertions', function (t) { + + t.plan(1) + + return function (done) { + + tapOut.observeStream(fixtureStream('yaml-indented-more')).failingAssertions$ + .forEach(function (assertion) { + + t.deepEqual(assertion.diagnostic, { + a: 'b' + }, 'parsed yaml block') + }) + } +}) + // Helpers function yamlTapStream () { @@ -273,6 +289,11 @@ function basicTapStream () { return fs.createReadStream(__dirname + '/fixtures/basic.txt') } +function fixtureStream (name) { + + return fs.createReadStream(__dirname + '/fixtures/' + name + '.txt') +} + function filterTypeInStream (stream, type) { return H(stream.pipe(tapOut.stream()))