Skip to content

Commit

Permalink
Fixed line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
szikszail committed Jul 21, 2017
1 parent 6586073 commit 744f416
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Lines {
const INDENTATION = ' ';

const utils = {
LINE_BREAK: '\r\n',
LINE_BREAK: '\n',

/**
* Indents the given text with
Expand Down
4 changes: 2 additions & 2 deletions test/ast/Background.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
});

Expand Down
2 changes: 1 addition & 1 deletion test/ast/DocString.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"""');
});
});
2 changes: 1 addition & 1 deletion test/ast/Scenario.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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([]);
});
Expand Down
2 changes: 1 addition & 1 deletion test/ast/Step.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"""');
});
});
2 changes: 1 addition & 1 deletion test/data/background.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
]
}
4 changes: 2 additions & 2 deletions test/data/background.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Background: this is a background
this is a really good
Background: this is a background
this is a good
background
2 changes: 1 addition & 1 deletion test/data/base.feature
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/data/scenario.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 11 additions & 11 deletions test/data/scenario.txt
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions test/utils.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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', () => {
Expand Down Expand Up @@ -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');
});
});
});
Expand Down

0 comments on commit 744f416

Please sign in to comment.