add support gowork for go-version-file

This commit is contained in:
koba1t committed 2022-11-01 21:25:30 +09:00
1 parent c4a742cab1
commit 7678c83214
7 files changed
+48 -7

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
go 1.19
use .
+18
View File
@@ -824,6 +824,12 @@ require (
replace example.com/thatmodule => ../thatmodule
exclude example.com/thismodule v1.3.0
`;
const goWorkContents = `go 1.19
use .
`;
it('reads version from go.mod', async () => {
@@ -838,6 +844,18 @@ exclude example.com/thismodule v1.3.0
expect(logSpy).toHaveBeenCalledWith('matching 1.14...');
});
it('reads version from go.work', async () => {
inputs['go-version-file'] = 'go.work';
existsSpy.mockImplementation(() => true);
readFileSpy.mockImplementation(() => Buffer.from(goWorkContents));
await main.run();
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.19');
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.19...');
expect(logSpy).toHaveBeenCalledWith('matching 1.19...');
});
it('reads version from .go-version', async () => {
inputs['go-version-file'] = '.go-version';
existsSpy.mockImplementation(() => true);