mirror of
https://github.com/kennyp/asdf-golang.git
synced 2024-10-06 04:32:07 +08:00
Add tests for parse-legacy-file
, to ensure the right version is selected (#89)
* Add tests for legacy version parser * Unsure how this ever worked before? Fix a weird flub I can’t explain. This can probably be fixup’ed into some other commit, but I’m using the web app, so, this is difficult
This commit is contained in:
parent
0f6f356b85
commit
f1ab0168ea
17
.github/workflows/main.yml
vendored
17
.github/workflows/main.yml
vendored
@ -2,7 +2,7 @@ name: CI
|
|||||||
on:
|
on:
|
||||||
# Triggers the workflow on push or pull request events but only for the master branch
|
# Triggers the workflow on push or pull request events but only for the master branch
|
||||||
push:
|
push:
|
||||||
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
@ -20,7 +20,20 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Test plugin
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: 🏗️ Create dummy install directories
|
||||||
|
run: |
|
||||||
|
./test-fixtures/create-dummy-installs.sh
|
||||||
|
|
||||||
|
- name: Test parsing 'go.mod'
|
||||||
|
run: |
|
||||||
|
bin/parse-legacy-file test-fixtures/go.mod | grep "^1.19.3"
|
||||||
|
- name: Test parsing '.go-version'
|
||||||
|
run: |
|
||||||
|
bin/parse-legacy-file test-fixtures/.go-version | grep "^1.17.13"
|
||||||
|
- name: Test plugin works to get latest version
|
||||||
uses: asdf-vm/actions/plugin-test@v1
|
uses: asdf-vm/actions/plugin-test@v1
|
||||||
with:
|
with:
|
||||||
command: go version
|
command: go version
|
||||||
|
1
test-fixtures/.go-version
Normal file
1
test-fixtures/.go-version
Normal file
@ -0,0 +1 @@
|
|||||||
|
1.17.13
|
18
test-fixtures/create-dummy-installs.sh
Executable file
18
test-fixtures/create-dummy-installs.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
declare -a fake_install_versions=(
|
||||||
|
1.16
|
||||||
|
1.17.1
|
||||||
|
1.17.7
|
||||||
|
1.17.13
|
||||||
|
1.18.1
|
||||||
|
1.18.2
|
||||||
|
1.18.6
|
||||||
|
1.19
|
||||||
|
1.19.3
|
||||||
|
)
|
||||||
|
|
||||||
|
mkdir -p ../../installs/asdf-golang
|
||||||
|
for version in "${fake_install_versions[@]}"; do
|
||||||
|
mkdir "../../installs/asdf-golang/${version}"
|
||||||
|
done
|
3
test-fixtures/go.mod
Normal file
3
test-fixtures/go.mod
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module github.com/kennyp/asdf-golang
|
||||||
|
|
||||||
|
go 1.18
|
Loading…
Reference in New Issue
Block a user