-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOTNET_ROOT and short generic versions (#131)
- Loading branch information
Zachary Eisinger
authored
Sep 24, 2020
1 parent
9d7c66c
commit 7a98346
Showing
6 changed files
with
187 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import each from 'jest-each'; | ||
import * as installer from '../src/installer'; | ||
|
||
describe('version tests', () => { | ||
each(['3.1.999', '3.1.101-preview.3']).test( | ||
"Exact version '%s' should be the same", | ||
vers => { | ||
let versInfo = new installer.DotNetVersionInfo(vers); | ||
|
||
expect(versInfo.isExactVersion()).toBe(true); | ||
expect(versInfo.version()).toBe(vers); | ||
} | ||
); | ||
|
||
each([ | ||
['3.1.x', '3.1'], | ||
['1.1.*', '1.1'], | ||
['2.0', '2.0'] | ||
]).test("Generic version '%s' should be '%s'", (vers, resVers) => { | ||
let versInfo = new installer.DotNetVersionInfo(vers); | ||
|
||
expect(versInfo.isExactVersion()).toBe(false); | ||
expect(versInfo.version()).toBe(resVers); | ||
}); | ||
|
||
each([ | ||
'', | ||
'.', | ||
'..', | ||
' . ', | ||
'. ', | ||
' .', | ||
' . . ', | ||
' .. ', | ||
' . ', | ||
'-1.-1', | ||
'-1', | ||
'-1.-1.-1', | ||
'..3', | ||
'1..3', | ||
'1..', | ||
'.2.3', | ||
'.2.x', | ||
'1', | ||
'2.x', | ||
'*.*.1', | ||
'*.1', | ||
'*.', | ||
'1.2.', | ||
'1.2.-abc', | ||
'a.b', | ||
'a.b.c', | ||
'a.b.c-preview', | ||
' 0 . 1 . 2 ' | ||
]).test("Malformed version '%s' should throw", vers => { | ||
expect(() => new installer.DotNetVersionInfo(vers)).toThrow(); | ||
}); | ||
|
||
each([ | ||
['3.1.x', '3.1.'], | ||
['3.1.*', '3.1.'], | ||
['3.1', '3.1.'], | ||
['5.0.0-preview.6', '5.0.0-preview.6'], | ||
['3.1.201', '3.1.201'] | ||
]).test( | ||
"Resolving version '%s' as '%s'", | ||
async (input, expectedVersion) => { | ||
const dotnetInstaller = new installer.DotnetCoreInstaller(input); | ||
let versInfo = await dotnetInstaller.resolveVersion( | ||
new installer.DotNetVersionInfo(input) | ||
); | ||
console.log(versInfo); | ||
|
||
expect(versInfo.startsWith(expectedVersion)); | ||
}, | ||
100000 | ||
); | ||
|
||
it('Resolving a nonexistent generic version fails', async () => { | ||
const dotnetInstaller = new installer.DotnetCoreInstaller('999.1.x'); | ||
try { | ||
await dotnetInstaller.resolveVersion( | ||
new installer.DotNetVersionInfo('999.1.x') | ||
); | ||
fail(); | ||
} catch { | ||
expect(true); | ||
} | ||
}, 100000); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.