Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Pass tests under macOS #340

Merged
merged 5 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ jobs:
- run: docker --version
- run: make test-pure-on-nix FISH_VERSION=${{ matrix.version.fish }}

# test-macos:
# name: Test on fish on MacOS
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v2
# - name: Install Fish
# run: brew install fish
# - name: Install Fisher > Fishtape > Pure
# run: curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher jorgebucaran/fishtape ./
# shell: fish {0}
# - name: Test Pure
# run: fishtape tests/*.test.fish
# shell: fish {0}
test-macos:
name: Test on fish on MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Install Fish
run: brew install fish
edouard-lopez marked this conversation as resolved.
Show resolved Hide resolved
- name: Install Fisher > Fishtape > Pure
run: curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher jorgebucaran/fishtape ./
shell: fish {0}
- name: Test Pure
run: fishtape tests/*.test.fish
shell: fish {0}

bump-version: # Bump when on master
needs: [test-container]
Expand Down
2 changes: 1 addition & 1 deletion functions/_pure_check_for_new_release.fish
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ function pure_get_latest_release_version \
curl \
--silent \
"https://api.github.com/repos/$user_repo/releases/latest" \
| string match --regex '"tag_name": "\K.*?(?=")'
| string match --regex '"tag_name": "\K.*?(?=")'
end
2 changes: 2 additions & 0 deletions tests/_pure_check_for_new_release.test.fish
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ before_each
before_each
@test "_pure_check_for_new_release: nothing when same as latest" (
set --universal pure_check_for_new_release true
set --erase pure_version
set --universal pure_version 0.0.1
function curl; echo '"tag_name": "v0.0.1",'; end # mock

Expand All @@ -29,6 +30,7 @@ before_each
before_each
@test "_pure_check_for_new_release: show fisher command to install when enable" (
set --universal pure_check_for_new_release true
set --erase pure_version
set --universal pure_version 0.0.1
function curl; echo '"tag_name": "v9.9.9",'; end # mock

Expand Down
21 changes: 16 additions & 5 deletions tests/_pure_is_inside_container.test.fish
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,23 @@ end
echo $called
) = once

cleanup_spy
@test "_pure_is_inside_container: true for Github Action" (
set --universal pure_enable_container_detection true
if test (uname -s) != Darwin
cleanup_spy
@test "_pure_is_inside_container: true for Github Action on Ubuntu" (
set --universal pure_enable_container_detection true

_pure_is_inside_container
) $status -eq $SUCCESS
_pure_is_inside_container
) $status -eq $SUCCESS
end

if test (uname -s) = Darwin
cleanup_spy
@test "_pure_is_inside_container: false for Github Action on MacOS" (
set --universal pure_enable_container_detection true

_pure_is_inside_container
) $status -eq $FAILURE
end

@test "_pure_is_inside_container: detect with $container variable" (
set --universal pure_enable_container_detection true
Expand Down
4 changes: 2 additions & 2 deletions tests/_pure_print_prompt_rows.test.fish
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ before_each
@test "_pure_print_prompt_rows: end with newline by default" (
set --universal pure_enable_single_line_prompt false

_pure_print_prompt_rows | wc -l
_pure_print_prompt_rows | wc -l | tr -d ' '
) = $IS_PRESENT

before_each
@test "_pure_print_prompt_rows: end WITHOUT newline when compact-prompt is enable" (
set --universal pure_enable_single_line_prompt true

_pure_print_prompt_rows | wc -l
_pure_print_prompt_rows | wc -l | tr -d ' '
) = $NONE


Expand Down
6 changes: 3 additions & 3 deletions tests/_pure_prompt_new_line.test.fish
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ end
set --universal pure_enable_single_line_prompt false
set _pure_fresh_session false

_pure_prompt_new_line | wc -l
_pure_prompt_new_line | wc -l | tr -d ' '
) -eq $IS_PRESENT

@test "_pure_prompt_new_line: print prompt without newline for new session" (
set --universal pure_enable_single_line_prompt false
set _pure_fresh_session true

_pure_prompt_new_line | wc -l
_pure_prompt_new_line | wc -l | tr -d ' '
) = $NONE

@test "_pure_prompt_new_line: print prompt without newline when single line prompt is enabled" (
set _pure_fresh_session false
set --universal pure_enable_single_line_prompt true

_pure_prompt_new_line | wc -l
_pure_prompt_new_line | wc -l | tr -d ' '
) = $NONE

before_each
Expand Down
4 changes: 2 additions & 2 deletions tests/fish_prompt.test.fish
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ before_all

@test "fish_prompt: use 2-lines prompt by default" (
set --universal pure_enable_single_line_prompt false
fish_prompt | wc -l
fish_prompt | wc -l | tr -d ' '
) = 2

@test "fish_prompt: use 1-line compact-prompt" (
set --universal pure_enable_single_line_prompt true

fish_prompt | wc -l
fish_prompt | wc -l | tr -d ' '
) = 1

after_all
Loading