github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/prog/target_test.go (about) 1 // Copyright 2024 syzkaller project authors. All rights reserved. 2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 package prog 5 6 import ( 7 "testing" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestRequiredGlobs(t *testing.T) { 13 assert.Equal(t, requiredGlobs("aa/bb"), []string{"aa/bb"}) 14 assert.Equal(t, requiredGlobs("aa:bb"), []string{"aa", "bb"}) 15 assert.Equal(t, requiredGlobs("aa:bb:-cc:dd"), []string{"aa", "bb", "dd"}) 16 } 17 18 func TestPopulateGlob(t *testing.T) { 19 assert.Empty(t, populateGlob("aa", map[string][]string{ 20 "bb": {"c"}, 21 })) 22 assert.Equal(t, populateGlob("aa", map[string][]string{ 23 "aa": {"d", "e"}, 24 "bb": {"c"}, 25 }), []string{"d", "e"}) 26 assert.Equal(t, populateGlob("aa:cc", map[string][]string{ 27 "aa": {"d", "e"}, 28 "bb": {"c"}, 29 "cc": {"f", "d"}, 30 }), []string{"d", "e", "f"}) 31 assert.Equal(t, populateGlob("aa:cc:-e", map[string][]string{ 32 "aa": {"d", "e"}, 33 "bb": {"c"}, 34 "cc": {"f", "d"}, 35 }), []string{"d", "f"}) 36 }