github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/projectfile/projectfile_linux_test.go (about) 1 package projectfile 2 3 import ( 4 "path/filepath" 5 "testing" 6 7 "github.com/ActiveState/cli/internal/environment" 8 "github.com/stretchr/testify/assert" 9 ) 10 11 func TestYamlMerge(t *testing.T) { 12 rootpath, err := environment.GetRootPath() 13 if err != nil { 14 t.Fatal(err) 15 } 16 17 project, err := Parse(filepath.Join(rootpath, "pkg", "projectfile", "testdata", "activestate.yaml")) 18 assert.NoError(t, err, "Should not throw an error") 19 20 assert.Equal(t, "dev,qa,prod", project.Environments) // should not be overridden by macOS's environment 21 22 assert.True(t, len(project.Constants) > 2) // should not be overridden by macOS's constants 23 for _, constant := range project.Constants { 24 switch constant.Name { 25 case "DEBUG": 26 assert.Equal(t, "true", constant.Value) // should not be overridden by macOS's 'false' value 27 case "PYTHONPATH": 28 assert.NotEmpty(t, constant.Value) 29 case "macOS": 30 assert.Fail(t, "macOS constant should not have been merged from activestate.macos.yaml") 31 } 32 } 33 }