Skip to content

Commit

Permalink
Separate stages for adding plugin and using it
Browse files Browse the repository at this point in the history
  • Loading branch information
tesujimath committed May 24, 2024
1 parent 9c185ba commit 3608cba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 28 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ jobs:
- name: Download Nushell $NU_VERSION
run: |
curl -L https://github.com/nushell/nushell/releases/download/${NU_VERSION}/nu-${NU_VERSION}-x86_64-linux-gnu-full.tar.gz | tar xzf -
- name: Run
- name: Run Tests
run: |
echo $HOME
ls -l $HOME
ls -l $HOME/.config
pwd
ls -l
./nu-${NU_VERSION}-x86_64-linux-gnu-full/nu run-tests.nu
BARE_NU="./nu-${NU_VERSION}-x86_64-linux-gnu-full/nu --no-config-file --no-history"
$BARE_NU -c "plugin add --plugin-config plugin.msgpackz nu_plugin_bash_env"
$BARE_NU -c "plugin use --plugin-config plugin.msgpackz bash_env ; use tests.nu run_bash_env_tests ; run_bash_env_tests'"
36 changes: 15 additions & 21 deletions run-tests.nu → tests.nu
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ use std assert
# TODO use testing.nu testing module,
# which wasn't working at the time I wrote these tests

#[before-all]
def add_and_use_plugin [] {
plugin add nu_plugin_bash_env
plugin use bash_env
}

#[test]
def test_echo [] {
let actual = echo "export A=123" | bash-env
Expand Down Expand Up @@ -90,18 +84,18 @@ def test_mixed [] {
assert equal $actual $expected
}

add_and_use_plugin

test_echo
test_not_exported
test_export_shell_variables
test_export_shell_variables_missing
test_shell_variables_from_file
test_export_shell_variables_from_file
test_empty_value
test_simple_file
test_cat_simple_file
test_nasty_values_from_file
test_mixed

print "All tests passed"
export def run_bash_env_tests [] {
test_echo
test_not_exported
test_export_shell_variables
test_export_shell_variables_missing
test_shell_variables_from_file
test_export_shell_variables_from_file
test_empty_value
test_simple_file
test_cat_simple_file
test_nasty_values_from_file
test_mixed

print "All tests passed"
}

0 comments on commit 3608cba

Please sign in to comment.