// Copyright (c) 2024 Celestino Amoroso (celestino.amoroso@gmail.com).
// All rights reserved.

// t_token_test.go
package expr

import (
	"fmt"
	"testing"
)

func TestDevString(t *testing.T) {
	type inputType struct {
		source     string
		sym        Symbol
		value      any
		wantResult string
	}

	inputs := []inputType{
		/*   1 */ {"100", SymInteger, 100, fmt.Sprintf(`[%d]"100"{100}`, SymInteger)},
		/*   2 */ {"+", SymPlus, nil, fmt.Sprintf(`[%d]"+"{}`, SymPlus)},
	}

	for i, input := range inputs {
		var tk *Token
		if input.value == nil {
			tk = NewToken(0, 0, input.sym, input.source)
		} else {
			tk = 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)
		}
	}
}
