@@ -51,6 +51,26 @@ func setupVfox(ctx context.Context, t *testing.T, ctr tc.Container, vfoxVersion
5151 t .Logf ("PASS %s with the local java plugin" , strings .TrimSpace (execOK (ctx , t , ctr , "vfox --version" )))
5252}
5353
54+ // checkVersionlessRejected proves a distribution without a version (e.g.
55+ // java@tem, java@-tem, see common.VersionlessSpecs) fails both `vfox
56+ // install` and `vfox use` with an error asking for one. The hooks raise it
57+ // before any Foojay lookup, so nothing is retried.
58+ func checkVersionlessRejected (ctx context.Context , t * testing.T , ctr tc.Container , distribution string ) {
59+ t .Helper ()
60+ for _ , spec := range common .VersionlessSpecs (distribution ) {
61+ want := "No version in " + spec + ";"
62+ for _ , c := range []struct { label , script string }{
63+ {"vfox install java@" + spec , "vfox install java@" + spec },
64+ {"vfox use --global java@" + spec , activated ("vfox use --global java@" + spec )},
65+ } {
66+ code , out := execRun (ctx , t , ctr , c .script )
67+ require .NotZerof (t , code , "%s must fail\n --- output ---\n %s" , c .label , out )
68+ require .Containsf (t , common .StripANSI (out ), want , "%s must ask for a version" , c .label )
69+ }
70+ t .Logf ("PASS java@%s is rejected by vfox install and vfox use" , spec )
71+ }
72+ }
73+
5474// checkMissingVersionRejected proves an unpublished release, and an
5575// unpublished build of the pinned one, fail loudly instead of installing
5676// something else: PreInstall finds no Foojay package and names the platform
0 commit comments