github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/gojs/config/config_test.go (about) 1 package config 2 3 import ( 4 "strings" 5 "testing" 6 7 "github.com/bananabytelabs/wazero/internal/testing/require" 8 ) 9 10 func TestConfig_Init(t *testing.T) { 11 t.Parallel() 12 13 t.Run("Workdir", func(t *testing.T) { 14 c := NewConfig() 15 require.Equal(t, "/", c.Workdir) 16 require.False(t, c.OsWorkdir) 17 18 c.OsWorkdir = true 19 20 require.NoError(t, c.Init()) 21 actual := c.Workdir 22 23 // Check c:\ or d:\ aren't retained. 24 require.Equal(t, -1, strings.IndexByte(actual, '\\')) 25 require.Equal(t, -1, strings.IndexByte(actual, ':')) 26 }) 27 }