@@ -65,8 +65,9 @@ func verifySearch(ctx context.Context, t *testing.T, ctr tc.Container, box slotB
6565// endings, while vfox lists an empty install of another release first (see
6666// common.Decoy). SDKMAN's identifier of an early-access build (e.g.
6767// java=21.0.0.0+ea.1-tem) must then select a faked install of that build
68- // (see common.EarlyAccess), not the release. It runs before any `vfox use`,
69- // so java can only come from the legacy file.
68+ // (see common.EarlyAccess), not the release, and so must its installed name
69+ // (e.g. java=21-ea+1-tem). It runs before any `vfox use`, so java can only
70+ // come from the legacy file.
7071func verifyLegacyFile (ctx context.Context , t * testing.T , ctr tc.Container , box slotBox , distribution , version , installed , arch string ) {
7172 t .Helper ()
7273 // vfox counts a version as installed once its directory holds
@@ -98,10 +99,13 @@ func verifyLegacyFile(ctx context.Context, t *testing.T, ctr tc.Container, box s
9899 "$bin = Join-Path %s %s; New-Item -ItemType Directory -Force -Path $bin | Out-Null; " +
99100 "Set-Content -Path (Join-Path $bin 'java.cmd') -Value %s" ,
100101 eaDir , pwshQuote (`java-` + ea + `\bin` ), pwshQuote ("@echo " + ea )), box .vars ... )
101- identifier := common .EarlyAccessIdentifier (distribution , version )
102- out := legacyJava (ctx , t , ctr , box , identifier )
103- require .Containsf (t , out , ea , ".sdkmanrc java=%s must select %s, not %s" , identifier , ea , installed )
104- t .Logf ("PASS .sdkmanrc java=%s selects %s, not %s" , identifier , ea , installed )
102+ // ParseLegacyFile could not parse the installed name, so it selected
103+ // nothing for it, while `vfox use` selects it (vfox-java#91).
104+ for _ , identifier := range []string {common .EarlyAccessIdentifier (distribution , version ), ea } {
105+ out := legacyJava (ctx , t , ctr , box , identifier )
106+ require .Containsf (t , out , ea , ".sdkmanrc java=%s must select %s, not %s" , identifier , ea , installed )
107+ t .Logf ("PASS .sdkmanrc java=%s selects %s, not %s" , identifier , ea , installed )
108+ }
105109 execOK (ctx , t , ctr , fmt .Sprintf ("Remove-Item -LiteralPath %s -Recurse -Force" , eaDir ), box .vars ... )
106110}
107111
0 commit comments