// Copyright (c) 2024-2026 Celestino Amoroso (celestino.amoroso@gmail.com). // All rights reserved. // t_token_test.go package expr import ( "fmt" "testing" "git.portale-stac.it/go-pkg/expr/scan" ) func TestDevString(t *testing.T) { type inputType struct { source string sym scan.Symbol value any wantResult string } inputs := []inputType{ /* 1 */ {"100", scan.SymInteger, 100, fmt.Sprintf(`[%d]"100"{100}`, scan.SymInteger)}, /* 2 */ {"+", scan.SymPlus, nil, fmt.Sprintf(`[%d]"+"{}`, scan.SymPlus)}, } for i, input := range inputs { var tk *scan.Token if input.value == nil { tk = scan.NewToken(0, 0, input.sym, input.source) } else { tk = scan.NewValueToken(0, 0, input.sym, input.source, input.value) } t.Logf("Test nr %2d: %q --> %q", i+1, input.source, input.wantResult) if s := tk.DevString(); s != input.wantResult { t.Errorf("wrong token from symbol '+': expected %q, got %q", input.wantResult, s) } } }