github.com/replit/upm@v0.0.0-20240423230255-9ce4fc3ea24c/test-suite/WhichLanguage_test.go (about) 1 package testSuite 2 3 import ( 4 "testing" 5 6 testUtils "github.com/replit/upm/test-suite/utils" 7 ) 8 9 var testWhichLanguage = map[string]bool{ 10 "bun": true, 11 "nodejs-npm": true, 12 "nodejs-pnpm": true, 13 "nodejs-yarn": true, 14 "python3-poetry": true, 15 "python3-pip": true, 16 } 17 18 func TestWhichLanguage(t *testing.T) { 19 defaults := map[string]bool{ 20 "bun": true, 21 } 22 23 for _, bt := range languageBackends { 24 bt.Start(t) 25 26 if !testWhichLanguage[bt.Backend.Name] { 27 t.Run(bt.Backend.Name, func(t *testing.T) { 28 t.Skip("no test") 29 }) 30 continue 31 } 32 33 template := bt.Backend.Name + "/one-dep/" 34 35 bt.Subtest(bt.Backend.Name, func(bt testUtils.BackendT) { 36 if bt.Backend.QuirksIsReproducible() { 37 bt.Subtest("locked", func(bt testUtils.BackendT) { 38 bt.AddTestFile(template+bt.Backend.Specfile, bt.Backend.Specfile) 39 bt.AddTestFile(template+bt.Backend.Lockfile, bt.Backend.Lockfile) 40 bt.UpmWhichLanguage() 41 }) 42 } else { 43 bt.Subtest("no lockfile", func(bt testUtils.BackendT) { 44 bt.AddTestFile(template+bt.Backend.Specfile, bt.Backend.Specfile) 45 bt.UpmWhichLanguage() 46 }) 47 } 48 49 if defaults[bt.Backend.Name] { 50 bt.Subtest("default", func(bt testUtils.BackendT) { 51 bt.AddTestFile(template+bt.Backend.Specfile, bt.Backend.Specfile) 52 bt.UpmWhichLanguage() 53 }) 54 } 55 }) 56 } 57 }