@@ -80,10 +80,11 @@ func TestInterpolate(t *testing.T) {
80
80
}
81
81
}
82
82
83
- func TestGetMacroRegex (t * testing.T ) {
84
- t .Run ("returns composed regular expression" , func (t * testing.T ) {
85
- assert .Equal (t , `\$__some_string\b(?:\((.*?)\))?` , getMacroRegex ("some_string" ))
86
- })
83
+ func TestGetMacroRegex_returns_composed_regular_expression (t * testing.T ) {
84
+ assert .Equal (t , `\$__some_string\b(?:\((.*?)\))?` , getMacroRegex ("some_string" ))
85
+ }
86
+
87
+ func TestGetMatches (t * testing.T ) {
87
88
t .Run ("FindAllStringSubmatch returns DefaultMacros" , func (t * testing.T ) {
88
89
for macroName := range DefaultMacros {
89
90
matches , err := getMatches (macroName , fmt .Sprintf ("$__%s" , macroName ))
@@ -92,15 +93,10 @@ func TestGetMacroRegex(t *testing.T) {
92
93
assert .Equal (t , [][]string {{fmt .Sprintf ("$__%s" , macroName ), "" }}, matches )
93
94
}
94
95
})
95
- }
96
+ t .Run ("does not return matches for macro name which is substring" , func (t * testing.T ) {
97
+ matches , err := getMatches ("timeFilter" , "$__timeFilterEpoch(time_column)" )
96
98
97
- func TestGetMacroRegex_returns_composed_regular_expression (t * testing.T ) {
98
- assert .Equal (t , `\$__some_string\b(?:\((.*?)\))?` , getMacroRegex ("some_string" ))
99
- }
100
-
101
- func TestGetMatches_does_not_match_for_macro_name_which_is_substring (t * testing.T ) {
102
- matches , err := getMatches ("timeFilter" , "$__timeFilterEpoch(time_column)" )
103
-
104
- assert .NoError (t , err )
105
- assert .Nil (t , matches )
99
+ assert .NoError (t , err )
100
+ assert .Nil (t , matches )
101
+ })
106
102
}
0 commit comments