Skip to content

Commit b0f166e

Browse files
Test .tool-version on top of Windows
1 parent 6389fe5 commit b0f166e

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.github/workflows/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ jobs:
9090
node-version: '20'
9191
- run: npm install --production
9292
- run: npm test
93+
- name: .tool-versions test
94+
id: setup-beam
95+
uses: ./
96+
with:
97+
install-rebar: false
98+
install-hex: false
99+
version-file: test/.tool-versions
100+
version-type: strict
93101

94102
unit_tests_macos:
95103
name: Unit tests (macOS)

test/setup-beam.test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -938,15 +938,19 @@ describe('version file', () => {
938938
const gleamVersion = unsimulateInput('gleam-version')
939939

940940
it('is parsed correctly', async () => {
941-
const erlang = '27'
942-
const elixir = '1.17.0'
943-
const gleam = '0.23.0'
944-
const toolVersions = `# a comment
941+
const erlang = '27.3.4.1'
942+
const elixir = '1.18.4'
943+
const gleam = '1.9.1'
944+
let toolVersions = `# a comment
945945
erlang ref:v${erlang}# comment, no space, and ref:v
946946
elixir ref:${elixir} # comment, with space and ref:
947947
not-gleam 0.23 # not picked up
948948
gleam ${gleam} \n`
949949
const filename = 'test/.tool-versions'
950+
if (process.platform === 'win32') {
951+
// Force \r\n to test in Windows
952+
toolVersions = toolVersion.replace(/\n/g, '\r\n')
953+
}
950954
fs.writeFileSync(filename, toolVersions)
951955
process.env.GITHUB_WORKSPACE = ''
952956
const appVersions = setupBeam.parseVersionFile(filename)

0 commit comments

Comments
 (0)