aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-03-22 23:23:03 +0100
committerDimitri Sokolyuk <demon@dim13.org>2015-03-22 23:23:03 +0100
commit50d8fcfe69fce34fed41b006189fd827a124bf97 (patch)
tree52f055c16a8771ddfda50eef7149fc1220015624
parent6162985cad3584b6389e1b113aec46c19ca4b52f (diff)
Switch to vararg
-rw-r--r--lexer_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/lexer_test.go b/lexer_test.go
index 22cb12e..785a810 100644
--- a/lexer_test.go
+++ b/lexer_test.go
@@ -2,7 +2,7 @@ package main
import "testing"
-func testInput(t *testing.T, s []string, ty int) {
+func testInput(t *testing.T, ty int, s ...string) {
for _, input := range s {
l := lex(input + "\n")
typ, s := l.Lex()
@@ -16,21 +16,21 @@ func testInput(t *testing.T, s []string, ty int) {
}
func TestInteger(t *testing.T) {
- testInput(t, []string{"1", "¯1", "123"}, INTEGER)
+ testInput(t, INTEGER, "1", "¯1", "123")
}
func TestFloat(t *testing.T) {
- testInput(t, []string{"1.120", "¯1.1", "1e1", "¯1.1e¯1"}, FLOAT)
+ testInput(t, FLOAT, "1.120", "¯1.1", "1e1", "¯1.1e¯1")
}
func TestComplex(t *testing.T) {
- testInput(t, []string{"1.1J1", "¯1J1", "1J¯1.1", "¯1.1e1J¯1"}, COMPLEX)
+ testInput(t, COMPLEX, "1.1J1", "¯1J1", "1J¯1.1", "¯1.1e1J¯1")
}
func TestString(t *testing.T) {
- testInput(t, []string{"abc"}, STRING)
+ testInput(t, STRING, "abc")
}
func TestQuoted(t *testing.T) {
- testInput(t, []string{"'abc''xyz'"}, QUOTED)
+ testInput(t, QUOTED, "'abc''xyz'")
}