2019-12-20 22:40:38 +03:00
|
|
|
package internal_test
|
2019-04-26 07:28:27 +03:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2019-12-20 22:40:38 +03:00
|
|
|
"github.com/d5/tengo/internal"
|
2019-04-26 07:28:27 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestIdentListString(t *testing.T) {
|
2019-12-20 22:40:38 +03:00
|
|
|
identListVar := &internal.IdentList{
|
|
|
|
List: []*internal.Ident{
|
2019-04-26 07:28:27 +03:00
|
|
|
{Name: "a"},
|
|
|
|
{Name: "b"},
|
|
|
|
{Name: "c"},
|
|
|
|
},
|
|
|
|
VarArgs: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
expectedVar := "(a, b, ...c)"
|
|
|
|
if str := identListVar.String(); str != expectedVar {
|
2019-12-20 22:40:38 +03:00
|
|
|
t.Fatalf("expected string of %#v to be %s, got %s",
|
|
|
|
identListVar, expectedVar, str)
|
2019-04-26 07:28:27 +03:00
|
|
|
}
|
|
|
|
|
2019-12-20 22:40:38 +03:00
|
|
|
identList := &internal.IdentList{
|
|
|
|
List: []*internal.Ident{
|
2019-04-26 07:28:27 +03:00
|
|
|
{Name: "a"},
|
|
|
|
{Name: "b"},
|
|
|
|
{Name: "c"},
|
|
|
|
},
|
|
|
|
VarArgs: false,
|
|
|
|
}
|
|
|
|
|
|
|
|
expected := "(a, b, c)"
|
|
|
|
if str := identList.String(); str != expected {
|
2019-12-20 22:40:38 +03:00
|
|
|
t.Fatalf("expected string of %#v to be %s, got %s",
|
|
|
|
identList, expected, str)
|
2019-04-26 07:28:27 +03:00
|
|
|
}
|
|
|
|
}
|