1
0

Add U for 19.05 spacing, closes #48

This commit is contained in:
Bán Dénes 2021-12-15 22:45:35 +01:00
parent 3745cf3c47
commit c46a0bcd16
6 changed files with 14 additions and 7 deletions

View File

@ -2,6 +2,7 @@ const a = require('./assert')
const prep = require('./prepare')
const default_units = {
U: 19.05,
u: 19,
cx: 18,
cy: 17

View File

@ -1,3 +1,4 @@
U: 19.05
u: 19
cx: 18
cy: 17

View File

@ -1,3 +1,4 @@
U: 19.05
u: 19
cx: 18
cy: 17

View File

@ -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, '<version>')
try {

View File

@ -1,4 +1,5 @@
{
"U": 19.05,
"u": 19,
"cx": 18,
"cy": 17,

View File

@ -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)
})
})