flamenco/internal/manager/config/config_test.go
Sybren A. Stüvel 4a201d47b4 Cleanup: add unit test for parsing backslashes in variable values
Backslashes can be included in two ways, as-is (which works fine) and
between double quotes (in which case they need escaping). This test checks
for both.
2022-08-29 17:28:40 +02:00

21 lines
634 B
Go

package config
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestVariablesWithBackslashes(t *testing.T) {
c, err := loadConf("test_files/config_with_backslashes.yaml")
require.NoError(t, err)
vars := c.VariablesLookup[VariableAudienceUsers]
expectSingle := `C:\Downloads\blender-1.0\blender.exe`
expectDouble := `C:\\Downloads\\blender-1.0\\blender.exe`
assert.Equal(t, expectSingle, vars["single-backslash"]["blender"])
assert.Equal(t, expectDouble, vars["double-backslash"]["blender"])
assert.Equal(t, expectSingle, vars["quoted-double-backslash"]["blender"])
}