mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-04-06 07:19:55 +00:00
Pretty printed code
This commit is contained in:
@ -16,60 +16,59 @@ import * as installer from '../src/installer';
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
|
||||
describe('version tests', () => {
|
||||
each([
|
||||
'3.1.999',
|
||||
'3.1.101-preview'
|
||||
]).test("Exact version '%s' should be the same", vers => {
|
||||
let versInfo = new installer.DotNetVersionInfo(vers);
|
||||
each(['3.1.999', '3.1.101-preview']).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);
|
||||
})
|
||||
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([
|
||||
['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 ",
|
||||
'',
|
||||
'.',
|
||||
'..',
|
||||
' . ',
|
||||
'. ',
|
||||
' .',
|
||||
' . . ',
|
||||
' .. ',
|
||||
' . ',
|
||||
'-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();
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe('installer tests', () => {
|
||||
beforeAll(async () => {
|
||||
@ -86,26 +85,35 @@ describe('installer tests', () => {
|
||||
}
|
||||
}, 100000);
|
||||
|
||||
it('Resolving a normal generic version works', async() => {
|
||||
it('Resolving a normal generic version works', async () => {
|
||||
const dotnetInstaller = new installer.DotnetCoreInstaller('3.1.x');
|
||||
let versInfo = await dotnetInstaller.resolveInfos(["win-x64"],new installer.DotNetVersionInfo('3.1.x'));
|
||||
let versInfo = await dotnetInstaller.resolveInfos(
|
||||
['win-x64'],
|
||||
new installer.DotNetVersionInfo('3.1.x')
|
||||
);
|
||||
|
||||
expect(versInfo.resolvedVersion.startsWith('3.1.'));
|
||||
}, 100000);
|
||||
|
||||
it('Resolving a nonexistent generic version fails', async() => {
|
||||
it('Resolving a nonexistent generic version fails', async () => {
|
||||
const dotnetInstaller = new installer.DotnetCoreInstaller('999.1.x');
|
||||
try{
|
||||
await dotnetInstaller.resolveInfos(["win-x64"],new installer.DotNetVersionInfo('999.1.x'));
|
||||
try {
|
||||
await dotnetInstaller.resolveInfos(
|
||||
['win-x64'],
|
||||
new installer.DotNetVersionInfo('999.1.x')
|
||||
);
|
||||
fail();
|
||||
} catch {
|
||||
expect(true);
|
||||
}
|
||||
}, 100000);
|
||||
|
||||
it('Resolving a exact version works', async() => {
|
||||
it('Resolving a exact version works', async () => {
|
||||
const dotnetInstaller = new installer.DotnetCoreInstaller('3.1.201');
|
||||
let versInfo = await dotnetInstaller.resolveInfos(["win-x64"],new installer.DotNetVersionInfo('3.1.201'));
|
||||
let versInfo = await dotnetInstaller.resolveInfos(
|
||||
['win-x64'],
|
||||
new installer.DotNetVersionInfo('3.1.201')
|
||||
);
|
||||
|
||||
expect(versInfo.resolvedVersion).toBe('3.1.201');
|
||||
}, 100000);
|
||||
|
Reference in New Issue
Block a user