2017-03-12 07:34:36 +00:00
|
|
|
/* vim: set ts=2: */
|
|
|
|
/*jshint loopfunc:true, mocha:true, node:true */
|
2013-12-06 16:49:25 +00:00
|
|
|
var SSF = require('../');
|
|
|
|
var fs = require('fs'), assert = require('assert');
|
|
|
|
var data = JSON.parse(fs.readFileSync('./test/implied.json','utf8'));
|
2013-12-16 15:36:22 +00:00
|
|
|
var skip = [];
|
2014-01-12 08:31:44 +00:00
|
|
|
function doit(d) {
|
2014-06-13 15:02:06 +00:00
|
|
|
d[1].forEach(function(r){if(r.length === 2)assert.equal(SSF.format(r[0],d[0]),r[1]);});
|
2014-01-12 08:31:44 +00:00
|
|
|
}
|
2013-12-06 16:49:25 +00:00
|
|
|
describe('implied formats', function() {
|
|
|
|
data.forEach(function(d) {
|
2017-03-12 07:34:36 +00:00
|
|
|
if(d.length == 2) it(String(d[0]), function() { doit(d); });
|
2014-01-12 08:31:44 +00:00
|
|
|
else it(d[1]+" for "+d[0], skip.indexOf(d[1]) > -1 ? null : function(){
|
2013-12-06 16:49:25 +00:00
|
|
|
assert.equal(SSF.format(d[1], d[0], {}), d[2]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|