1// Copyright (c) 2021, Peter Ohler, All rights reserved. 2 3package asm_test 4 5import ( 6 "testing" 7 8 "github.com/ohler55/ojg/asm" 9 "github.com/ohler55/ojg/sen" 10 "github.com/ohler55/ojg/tt" 11) 12 13func TestNull(t *testing.T) { 14 root := testPlan(t, 15 `[ 16 [set $.asm.a [null? null]] 17 [set $.asm.b [null? a_string]] 18 ]`, 19 "{src: []}", 20 ) 21 tt.Equal(t, "{a:true b:false}", sen.String(root["asm"], &sopt)) 22} 23 24func TestNullArgCount(t *testing.T) { 25 p := asm.NewPlan([]interface{}{ 26 []interface{}{"null?", 1, 2}, 27 }) 28 err := p.Execute(map[string]interface{}{}) 29 tt.NotNil(t, err) 30} 31