forked from GitHub/gf-core
Unmarshalling for floats and strings, but strings crashes after multiple invocations
This commit is contained in:
@@ -209,7 +209,7 @@ describe('abstract syntax', () => {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
describe('expressions', () => {
|
||||
describe.only('expressions', () => {
|
||||
test('small integer', () => {
|
||||
const e1 = PGF.readExpr('123')
|
||||
const e2 = new PGF.ExprLit(123)
|
||||
@@ -253,4 +253,36 @@ describe('expressions', () => {
|
||||
expect(e1).toEqual(e2)
|
||||
expect(e1).not.toEqual(e3)
|
||||
})
|
||||
|
||||
test('float', () => {
|
||||
const e1 = PGF.readExpr('3.142')
|
||||
const e2 = new PGF.ExprLit(3.142)
|
||||
const e3 = new PGF.ExprLit(2.014)
|
||||
expect(e1).toEqual(e2)
|
||||
expect(e1).not.toEqual(e3)
|
||||
})
|
||||
|
||||
test('negative float', () => {
|
||||
const e1 = PGF.readExpr('-3.142')
|
||||
const e2 = new PGF.ExprLit(-3.142)
|
||||
const e3 = new PGF.ExprLit(-2.014)
|
||||
expect(e1).toEqual(e2)
|
||||
expect(e1).not.toEqual(e3)
|
||||
})
|
||||
|
||||
test('string', () => {
|
||||
const e1 = PGF.readExpr('"abc"')
|
||||
const e2 = new PGF.ExprLit('abc')
|
||||
const e3 = new PGF.ExprLit('def')
|
||||
expect(e1).toEqual(e2)
|
||||
expect(e1).not.toEqual(e3)
|
||||
})
|
||||
|
||||
test('string unicode', () => {
|
||||
const e1 = PGF.readExpr('"açġħ"')
|
||||
const e2 = new PGF.ExprLit('açġħ')
|
||||
const e3 = new PGF.ExprLit('acgh')
|
||||
expect(e1).toEqual(e2)
|
||||
expect(e1).not.toEqual(e3)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user