2016-10-17 18:37:56 +01:00
|
|
|
package auto
|
|
|
|
|
|
2025-06-05 00:37:52 +03:00
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"testing"
|
|
|
|
|
)
|
2016-10-17 18:37:56 +01:00
|
|
|
|
|
|
|
|
func TestRewriteToExpand(t *testing.T) {
|
2025-06-05 00:37:52 +03:00
|
|
|
t.Parallel()
|
2016-10-17 18:37:56 +01:00
|
|
|
tests := []struct {
|
|
|
|
|
in string
|
|
|
|
|
expected string
|
|
|
|
|
}{
|
|
|
|
|
{in: "", expected: ""},
|
|
|
|
|
{in: "{1}", expected: "${1}"},
|
|
|
|
|
{in: "{1", expected: "${1"},
|
|
|
|
|
}
|
|
|
|
|
for i, tc := range tests {
|
2025-06-05 00:37:52 +03:00
|
|
|
t.Run(fmt.Sprintf("test_%d", i), func(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
got := rewriteToExpand(tc.in)
|
|
|
|
|
if got != tc.expected {
|
|
|
|
|
t.Errorf("Test %d: Expected error %v, but got %v", i, tc.expected, got)
|
|
|
|
|
}
|
|
|
|
|
})
|
2016-10-17 18:37:56 +01:00
|
|
|
}
|
|
|
|
|
}
|