diff --git a/src/units.js b/src/units.js index 3bedd2a..f0b1cef 100644 --- a/src/units.js +++ b/src/units.js @@ -2,6 +2,7 @@ const a = require('./assert') const prep = require('./prepare') const default_units = { + U: 19.05, u: 19, cx: 18, cy: 17 diff --git a/test/cli/big/reference/points/units.yaml b/test/cli/big/reference/points/units.yaml index 71aa93b..579c750 100644 --- a/test/cli/big/reference/points/units.yaml +++ b/test/cli/big/reference/points/units.yaml @@ -1,3 +1,4 @@ +U: 19.05 u: 19 cx: 18 cy: 17 diff --git a/test/cli/minimal/reference/points/units.yaml b/test/cli/minimal/reference/points/units.yaml index f50c8d8..6df000d 100644 --- a/test/cli/minimal/reference/points/units.yaml +++ b/test/cli/minimal/reference/points/units.yaml @@ -1,3 +1,4 @@ +U: 19.05 u: 19 cx: 18 cy: 17 diff --git a/test/index.js b/test/index.js index f12dd8b..b552c62 100644 --- a/test/index.js +++ b/test/index.js @@ -136,10 +136,12 @@ for (let w of cli_what) { const comp_res = dircompare.compareSync(output_path, path.join(t, 'reference'), { compareContent: true }) - comp_res.same.should.be.true - if (!dump) { + if (dump) { + fs.moveSync(output_path, path.join(t, 'output'), {overwrite: true}) + } else { fs.removeSync(output_path) } + comp_res.same.should.be.true } else { const ref_error = read(t, 'error').replace(version_regex, '') try { diff --git a/test/points/units___units.json b/test/points/units___units.json index 9f2a007..48690d9 100644 --- a/test/points/units___units.json +++ b/test/points/units___units.json @@ -1,4 +1,5 @@ { + "U": 19.05, "u": 19, "cx": 18, "cy": 17, diff --git a/test/unit/units.js b/test/unit/units.js index 19bf781..393090a 100644 --- a/test/unit/units.js +++ b/test/unit/units.js @@ -5,7 +5,8 @@ describe('Units', function() { it('defaults', function() { // check that an empty config has the default units (and nothing more) const def = u.parse({}) - Object.keys(def).length.should.equal(3) + Object.keys(def).length.should.equal(4) + def.U.should.equal(19.05) def.u.should.equal(19) def.cx.should.equal(18) def.cy.should.equal(17) @@ -19,7 +20,7 @@ describe('Units', function() { b: 'a + 1' } }) - Object.keys(res).length.should.equal(5) + Object.keys(res).length.should.equal(6) res.a.should.equal(9) res.b.should.equal(10) // also check that order matters, which it should @@ -38,11 +39,11 @@ describe('Units', function() { a: 'cx / 2', }, variables: { - a: 'u + 1' + a: 'U + 1' } }) - Object.keys(res).length.should.equal(4) - res.a.should.equal(20) + Object.keys(res).length.should.equal(5) + res.a.should.equal(20.05) }) }) \ No newline at end of file