From 9284eb4115a38d1a45f12b343a4bf9a4cae90331 Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Sun, 30 Mar 2014 22:30:30 -0700 Subject: [PATCH] Add basic page tests --- test/fixtures/PAGE.MD | 30 ++++++++++++++++++++++++++++++ test/page.js | 15 +++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 test/fixtures/PAGE.MD create mode 100644 test/page.js diff --git a/test/fixtures/PAGE.MD b/test/fixtures/PAGE.MD new file mode 100644 index 000000000..79fc10c61 --- /dev/null +++ b/test/fixtures/PAGE.MD @@ -0,0 +1,30 @@ +# Python basics + +Python is a nice language, you can add stuff. Bla bla bla. + +Lets jump into an exercise : + +--- + +It's dead simple, `c` must be the sum of `a` and `b` + +```py +a = 1 +b = 2 +``` + +```py +a = 1 +b = 2 +c = a + b +``` + +```py +assert(c, 3) +``` + +--- + +Some more nice content .... + +[Cool stuff](http://gitbook.io) diff --git a/test/page.js b/test/page.js new file mode 100644 index 000000000..9ed91bbff --- /dev/null +++ b/test/page.js @@ -0,0 +1,15 @@ +var fs = require('fs'); +var path = require('path'); +var assert = require('assert'); + +var page = require('../lib/page'); + + +var CONTENT = fs.readFileSync(path.join(__dirname, './fixtures/PAGE.md'), 'utf8'); +var LEXED = page(CONTENT); + +describe('Page parsing', function() { + it('should detection sections', function() { + assert.equal(LEXED.length, 3); + }); +});