Comparing version 0.2.0 to 0.2.2
@@ -0,1 +1,5 @@ | ||
## v0.2.2 - July 30, 2014 | ||
* Fix `--lang` not working properly. | ||
## v0.2.0 - July 30, 2014 | ||
@@ -2,0 +6,0 @@ |
@@ -21,3 +21,3 @@ var hljs = require('highlight.js'); | ||
try { | ||
out = hljs.highlight(ext, str); | ||
out = hljs.highlight(lang, str); | ||
} catch (e) { | ||
@@ -24,0 +24,0 @@ out = hljs.highlightAuto(str); |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "0.2.0", | ||
"version": "0.2.2", | ||
"description": "Command-line syntax highlighter.", | ||
@@ -8,0 +8,0 @@ "main": "index.js", |
@@ -16,2 +16,28 @@ var expect = require('chai').expect, | ||
describe('Explicitly setting the language', function() { | ||
var out, input; | ||
beforeEach(function () { | ||
input = 'var x = 2 + "hi"; /*yo*/'; | ||
out = hicat(input, { lang: 'javascript' }); | ||
}); | ||
it('produces .language', function () { | ||
expect(out.language).be.eql('javascript'); | ||
}); | ||
}); | ||
describe('Explicitly setting an invalid language', function() { | ||
var str, out, input; | ||
beforeEach(function () { | ||
input = '{"a":2}'; | ||
out = hicat(input, { lang: 'aoeu' }); | ||
}); | ||
it('auto-detects the language', function () { | ||
expect(out.language).be.eql('json'); | ||
}); | ||
}); | ||
describe('A simple example', function() { | ||
@@ -40,3 +66,3 @@ var str, out, input; | ||
var code = str.replace(/\033[^m]+m/g, ''); | ||
expect(code).eql('var x = 2 + "hi"; /*yo*/'); | ||
expect(code).eql(input); | ||
}); | ||
@@ -43,0 +69,0 @@ |
9295
223