From 3608cba4e6c5f0d5c070f33a9db1029f11683dbf Mon Sep 17 00:00:00 2001 From: Simon Guest Date: Fri, 24 May 2024 17:06:57 +1200 Subject: [PATCH] Separate stages for adding plugin and using it --- .github/workflows/test-suite.yml | 11 ++++------ run-tests.nu => tests.nu | 36 +++++++++++++------------------- 2 files changed, 19 insertions(+), 28 deletions(-) rename run-tests.nu => tests.nu (84%) diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml index 0057687..5a6d2d9 100644 --- a/.github/workflows/test-suite.yml +++ b/.github/workflows/test-suite.yml @@ -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'" diff --git a/run-tests.nu b/tests.nu similarity index 84% rename from run-tests.nu rename to tests.nu index 964d455..e52c3d3 100644 --- a/run-tests.nu +++ b/tests.nu @@ -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 @@ -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" +}