From 744f41641a1c5d35d21ea12ed26abe4995c94a97 Mon Sep 17 00:00:00 2001 From: Laszlo Szikszai Date: Sat, 22 Jul 2017 00:43:13 +0200 Subject: [PATCH] Fixed line breaks --- lib/utils.js | 2 +- test/ast/Background.spec.js | 4 ++-- test/ast/DocString.spec.js | 2 +- test/ast/Scenario.spec.js | 2 +- test/ast/Step.spec.js | 2 +- test/data/background.json | 2 +- test/data/background.txt | 4 ++-- test/data/base.feature | 2 +- test/data/scenario.json | 2 +- test/data/scenario.txt | 22 +++++++++++----------- test/utils.spec.js | 8 ++++---- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index ca43e36..cb966cc 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -44,7 +44,7 @@ class Lines { const INDENTATION = ' '; const utils = { - LINE_BREAK: '\r\n', + LINE_BREAK: '\n', /** * Indents the given text with diff --git a/test/ast/Background.spec.js b/test/ast/Background.spec.js index cf96183..c934fe1 100644 --- a/test/ast/Background.spec.js +++ b/test/ast/Background.spec.js @@ -12,11 +12,11 @@ const expect = require('chai').expect; describe('Ast.Background', () => { it('should represent an Ast Background instance', () => { - const background = new Background('Background', 'this is a background', 'this is a good background\r\n a'); + const background = new Background('Background', 'this is a background', 'this is a good background\n a'); expect(background).to.be.instanceOf(Background); expect(background.keyword).to.equal('Background'); expect(background.name).to.equal('this is a background'); - expect(background.description).to.equal('this is a good background\r\na'); + expect(background.description).to.equal('this is a good background\na'); expect(background.steps).to.eql([]); }); diff --git a/test/ast/DocString.spec.js b/test/ast/DocString.spec.js index 760f381..77211b2 100644 --- a/test/ast/DocString.spec.js +++ b/test/ast/DocString.spec.js @@ -25,6 +25,6 @@ describe('Ast.DocString', () => { it('should have proper string representation', () => { const docString = new DocString('Hello\nWorld'); - expect(docString.toString()).to.equal('"""\r\nHello\r\nWorld\r\n"""'); + expect(docString.toString()).to.equal('"""\nHello\nWorld\n"""'); }); }); \ No newline at end of file diff --git a/test/ast/Scenario.spec.js b/test/ast/Scenario.spec.js index 6cf8283..5572404 100644 --- a/test/ast/Scenario.spec.js +++ b/test/ast/Scenario.spec.js @@ -17,7 +17,7 @@ describe('Ast.Scenario', () => { expect(scenario).to.be.instanceOf(Scenario); expect(scenario.keyword).to.equal('Scenario'); expect(scenario.name).to.equal('this is a scenario'); - expect(scenario.description).to.equal('this is a good scenario\r\na'); + expect(scenario.description).to.equal('this is a good scenario\na'); expect(scenario.tags).to.eql([]); expect(scenario.steps).to.eql([]); }); diff --git a/test/ast/Step.spec.js b/test/ast/Step.spec.js index 36a2f4a..fe788fc 100644 --- a/test/ast/Step.spec.js +++ b/test/ast/Step.spec.js @@ -41,6 +41,6 @@ describe('Ast.Step', () => { it('should have proper string representation', () => { const step = new Step('When ', 'this is a when step'); step.argument = new DocString('Hello\nWorld'); - expect(step.toString()).to.equal('When this is a when step\r\n"""\r\nHello\r\nWorld\r\n"""'); + expect(step.toString()).to.equal('When this is a when step\n"""\nHello\nWorld\n"""'); }); }); \ No newline at end of file diff --git a/test/data/background.json b/test/data/background.json index 698b899..b430796 100644 --- a/test/data/background.json +++ b/test/data/background.json @@ -2,7 +2,7 @@ "type": "Background", "keyword": "Background", "name": "this is a background", - "description": "this is a really good\n background", + "description": "this is a good\n background", "steps": [ ] } \ No newline at end of file diff --git a/test/data/background.txt b/test/data/background.txt index d0912eb..c3a44ff 100644 --- a/test/data/background.txt +++ b/test/data/background.txt @@ -1,3 +1,3 @@ -Background: this is a background - this is a really good +Background: this is a background + this is a good background \ No newline at end of file diff --git a/test/data/base.feature b/test/data/base.feature index bcbb372..5774bbe 100644 --- a/test/data/base.feature +++ b/test/data/base.feature @@ -1,6 +1,6 @@ @tag1 @tag2 Feature: Hello world - As a someone + As a smth I want to do smth So that I am smth diff --git a/test/data/scenario.json b/test/data/scenario.json index 6d19156..e275e0e 100644 --- a/test/data/scenario.json +++ b/test/data/scenario.json @@ -2,7 +2,7 @@ "type": "Scenario", "keyword": "Scenario", "name": "this is a scenario", - "description": "this is a really good\n scenario", + "description": "this is a good\n scenario", "tags": [ { "type": "Tag", diff --git a/test/data/scenario.txt b/test/data/scenario.txt index 9468f4c..45bb4a5 100644 --- a/test/data/scenario.txt +++ b/test/data/scenario.txt @@ -1,12 +1,12 @@ -@tag1 @tag2 -Scenario: this is a scenario - this is a really good - scenario - - Given this is a given step - When this is a when step with docString - """ - Hello - World - """ +@tag1 @tag2 +Scenario: this is a scenario + this is a good + scenario + + Given this is a given step + When this is a when step with docString + """ + Hello + World + """ But this should not be a when step \ No newline at end of file diff --git a/test/utils.spec.js b/test/utils.spec.js index b637235..829de4e 100644 --- a/test/utils.spec.js +++ b/test/utils.spec.js @@ -15,7 +15,7 @@ describe('Utils', () => { }); it('should handle multi-line texts too', () => { - expect(utils.normalize(' some\n text again ')).to.equal('some\r\ntext again'); + expect(utils.normalize(' some\n text again ')).to.equal('some\ntext again'); }); it('should handle if not argument is passed', () => { @@ -29,7 +29,7 @@ describe('Utils', () => { }); it('should indent multi-line text', () => { - expect(utils.indent('text to indent\nagain', 2)).to.equal(' text to indent\r\n again'); + expect(utils.indent('text to indent\nagain', 2)).to.equal(' text to indent\n again'); }); it('should indent with one level by default', () => { @@ -92,12 +92,12 @@ describe('Utils', () => { it('should handle multiple lines too', () => { lines.add('new line\nother line'); - expect(lines.toString()).to.equal('new line\r\nother line'); + expect(lines.toString()).to.equal('new line\nother line'); }); it('should handle empty lines', () => { lines.add('new line', null, 'other line', undefined, 'another line'); - expect(lines.toString()).to.equal('new line\r\n\r\nother line\r\n\r\nanother line'); + expect(lines.toString()).to.equal('new line\n\nother line\n\nanother line'); }); }); });