-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44d57df
commit baf4b35
Showing
13 changed files
with
170 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
test/tags/analyzer/invalid.tag -> test/expected/cmp.js | ||
test/tags/analyzer/tag-not-closed.tag -> test/expected/cmp.js | ||
test/tags/analyzer/tag-unmatch.tag -> test/expected/cmp.js | ||
test/tags/analyzer/valid.tag -> test/expected/cmp.js | ||
test/tags/analyzer/without-indent.tag -> test/expected/cmp.js | ||
test/tags/component-2.tag -> test/expected/cmp.js | ||
test/tags/component.tag -> test/expected/cmp.js | ||
test/tags/wrong-component.tag -> test/expected/cmp.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
test/tags/analyzer/invalid.tag -> test/tags/analyzer/invalid.js | ||
test/tags/analyzer/tag-not-closed.tag -> test/tags/analyzer/tag-not-closed.js | ||
test/tags/analyzer/tag-unmatch.tag -> test/tags/analyzer/tag-unmatch.js | ||
test/tags/analyzer/valid.tag -> test/tags/analyzer/valid.js | ||
test/tags/analyzer/without-indent.tag -> test/tags/analyzer/without-indent.js | ||
test/tags/component-2.tag -> test/tags/component-2.js | ||
test/tags/component.tag -> test/tags/component.js | ||
test/tags/wrong-component.tag -> test/tags/wrong-component.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
describe('Cli Tests', function() { | ||
global.expect = require('expect.js') | ||
require('./specs/output.spec') | ||
require('./specs/analyzer.spec') | ||
require('./specs/api.spec') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
require('shelljs/global') | ||
|
||
const ANALYZER_TAGS_FOLDER = 'test/tags/analyzer/', | ||
analyzer = require('../../lib/analyzer') | ||
|
||
describe('Analyzer', () => { | ||
|
||
it('returns no error if the tag is valid', () => { | ||
var errors = analyzer(cat(`${ANALYZER_TAGS_FOLDER}valid.tag`)).filter((r) => r.error ) | ||
expect(errors.length).to.equal(0) | ||
}) | ||
it('returns an error if the tag is not closed', () => { | ||
var results = analyzer(cat(`${ANALYZER_TAGS_FOLDER}tag-not-closed.tag`)) | ||
expect(results[3].error).to.equal('Last tag definition is not closed') | ||
}) | ||
it('returns an error if there are unmatched closing tags', () => { | ||
var results = analyzer(cat(`${ANALYZER_TAGS_FOLDER}tag-unmatch.tag`)) | ||
expect(results[3].error).to.equal('Closing tag unmatch') | ||
expect(results[5].error).to.equal('Last tag definition is not closed') | ||
}) | ||
it('returns an error if there are no indentations within tag', () => { | ||
var results = analyzer(cat(`${ANALYZER_TAGS_FOLDER}without-indent.tag`)) | ||
expect(results[1].error).to.equal('Indentation needed within tag definition') | ||
expect(results[2].error).to.equal('Indentation needed within tag definition') | ||
}) | ||
it('returns an error if there are invalid tag flagments', () => { | ||
var results = analyzer(cat(`${ANALYZER_TAGS_FOLDER}invalid.tag`)) | ||
expect(results[5].error).to.equal('Indentation needed within tag definition') | ||
expect(results[10].error).to.equal('Invalid tag flagment') | ||
expect(results[16].error).to.equal('Invalid tag flagment') | ||
}) | ||
|
||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var riot = require('riot') | ||
|
||
<valid-tag> | ||
<h1>{ title }</h1> | ||
<p>{ message }</p> | ||
<invalid-flagment | ||
this.title = 'Hello world!' | ||
this.message = 'I am hungry...' | ||
</valid-tag> | ||
|
||
<invalid-t | ||
<h1>{ title }</h1> | ||
<p>{ message }</p> | ||
|
||
this.title = 'Hello world!' | ||
this.message = 'I am hungry...' | ||
</invalid-t | ||
|
||
console.log('end of file') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<tag-not-closed> | ||
<p>Hello!</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<tag-unmatch> | ||
<p>Hello!</p> | ||
</tag-unmatch> | ||
</tag-unmatched> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var riot = require('riot') | ||
|
||
<valid-tag> | ||
<h1>{ title }</h1> | ||
<p>{ message }</p> | ||
|
||
this.title = 'Hello world!' | ||
this.message = 'I am hungry...' | ||
</valid-tag> | ||
|
||
<line-tag>Hello { opts.message }!</line-tag> | ||
|
||
<tag-with-style> | ||
<p>Hi!</p> | ||
<style scoped> | ||
p { color: red } | ||
</style> | ||
</tag-with-style> | ||
|
||
<tag-with-script> | ||
<h1>{ title }</h1> | ||
<p>{ message }</p> | ||
<script> | ||
this.title = 'Hello world!' | ||
this.message = 'I am hungry...' | ||
</script> | ||
</tag-with-script> | ||
|
||
console.log('end of file') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<without-indent> | ||
<p>Without indent</p> | ||
<div> | ||
Without indent</div> | ||
</without-indent> |