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:
whi-tw 2023-05-09 15:52:10 +01:00 committed by GitHub
parent 0f6f356b85
commit f1ab0168ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 2 deletions

View File

@ -2,7 +2,7 @@ name: CI
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
pull_request:
# Allows you to run this workflow manually from the Actions tab
@ -20,7 +20,20 @@ jobs:
runs-on: ${{ matrix.os }}
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
with:
command: go version

View File

@ -0,0 +1 @@
1.17.13

View 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
View File

@ -0,0 +1,3 @@
module github.com/kennyp/asdf-golang
go 1.18