From 5cdaa515d9837640e4ece16273464eb1802f33cd Mon Sep 17 00:00:00 2001 From: Christian Goll Date: Mon, 10 Feb 2025 10:11:55 +0100 Subject: [PATCH] additional malformed tests Signed-off-by: Christian Goll --- internal/pkg/hostlist/hostlist_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/internal/pkg/hostlist/hostlist_test.go b/internal/pkg/hostlist/hostlist_test.go index 62c81e1f..616e650a 100644 --- a/internal/pkg/hostlist/hostlist_test.go +++ b/internal/pkg/hostlist/hostlist_test.go @@ -43,6 +43,26 @@ func TestHostList(t *testing.T) { input: []string{"n[01-03]"}, output: []string{"n01", "n02", "n03"}, }, + "double expansion": { + input: []string{"r[1-2]-n[3-4]"}, + output: []string{"r1-n3", "r1-n4", "r2-n3", "r2-n4"}, + }, + "double expansion, with commas": { + input: []string{"r[1,2]-n[3,4]"}, + output: []string{"r1-n3", "r1-n4", "r2-n3", "r2-n4"}, + }, + "wrong comma order": { + input: []string{"node[4,1]"}, + output: []string{"node4", "node1"}, + }, + "wrong dash order": { + input: []string{"node[4-1]"}, + output: nil, + }, + "minus node": { + input: []string{"node[-1]"}, + output: []string{"node0", "node1"}, + }, } for name, tt := range tests {