@@ -174,7 +174,10 @@ func verifyToolchain(ctx context.Context, t *testing.T, ctr tc.Container, box sl
174174// build number PreUse finds among the installed versions;
175175// 3. the asdf-style <long-name>-<version>[-fx] spelling (e.g.
176176// java@temurin-21.0.8+9), which PreUse rewrites to <version>-<short>
177- // (<version> for OpenJDK, installed without a suffix).
177+ // (<version> for OpenJDK, installed without a suffix);
178+ // 4. the release padded with a zero, as SDKMAN writes releases (e.g.
179+ // java@21.0.8.0-tem, java@21.0.8.0+9-tem, see common.PaddedSpecs),
180+ // which `vfox install` must first find already installed.
178181//
179182// After each `vfox use`, java on PATH must still be the installed JDK.
180183func verifyPreUse (ctx context.Context , t * testing.T , ctr tc.Container , box slotBox , activation , distribution , version , installed string ) {
@@ -183,6 +186,16 @@ func verifyPreUse(ctx context.Context, t *testing.T, ctr tc.Container, box slotB
183186 if alias , ok := common .Alias (distribution , installed ); ok {
184187 spellings = append (spellings , alias )
185188 }
189+ // Foojay leaves the zero out, so PreInstall names the installed JDK and
190+ // vfox downloads nothing.
191+ padded := common .PaddedSpecs (distribution , version , installed )
192+ for _ , spec := range padded {
193+ out := execRetry (ctx , t , ctr , "vfox install java@" + spec , "vfox install " + pwshQuote ("java@" + spec ), box .vars ... )
194+ require .Containsf (t , common .StripANSI (out ), "java@" + installed + " is already installed" ,
195+ "vfox install java@%s must find the installed %s" , spec , installed )
196+ }
197+ t .Logf ("PASS vfox install java@%s finds %s installed" , strings .Join (padded , ", java@" ), installed )
198+ spellings = append (spellings , padded ... )
186199 for _ , spelling := range spellings {
187200 out := execOK (ctx , t , ctr , activated (activation , "vfox use --global " + pwshQuote ("java@" + spelling )), box .vars ... )
188201 require .Containsf (t , common .StripANSI (out ), "Now using java@" + installed + "." ,
0 commit comments