diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-10 11:34:56 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-10 11:34:56 +0200 |
commit | 02d8272c74b8b7f2da4e39c432e6521047ea8900 (patch) | |
tree | 597c0f89600a5c35e1e6f32cc67a6a1ed66579c5 /test/sections.js | |
parent | 2e85380cd822e05072b00d5f2493c263ac194395 (diff) | |
parent | e54b8080933f7e85df6b2182cc171dd3dc28f8a4 (diff) | |
download | gitbook-02d8272c74b8b7f2da4e39c432e6521047ea8900.zip gitbook-02d8272c74b8b7f2da4e39c432e6521047ea8900.tar.gz gitbook-02d8272c74b8b7f2da4e39c432e6521047ea8900.tar.bz2 |
Merge pull request #77 from GitbookIO/improve/sections_lexing
Improve/sections lexing
Diffstat (limited to 'test/sections.js')
-rw-r--r-- | test/sections.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/sections.js b/test/sections.js new file mode 100644 index 0000000..ef4abf9 --- /dev/null +++ b/test/sections.js @@ -0,0 +1,22 @@ +var fs = require('fs'); +var path = require('path'); +var assert = require('assert'); + +var lex = require('../').parse.lex; + + +var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/SECTIONS.md'), 'utf8'); +var LEXED = lex(CONTENT); + + +describe('Section parsing', function() { + it('should correctly split sections', function() { + assert.equal(LEXED.length, 3); + }); + + it('should robustly detect exercises', function() { + assert.equal(LEXED[0].type, 'normal'); + assert.equal(LEXED[1].type, 'exercise'); + assert.equal(LEXED[2].type, 'exercise'); + }); +}); |