From f644ebf642d2d9f7fb7e05ae1681aa808a11aeba Mon Sep 17 00:00:00 2001 From: Daniel Loureiro Date: Sat, 7 Dec 2024 08:33:39 +0000 Subject: [PATCH 1/9] :arrow_up: chore: bump versions of bash-aliases and uv features --- src/bash-aliases/devcontainer-feature.json | 2 +- src/uv/devcontainer-feature.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bash-aliases/devcontainer-feature.json b/src/bash-aliases/devcontainer-feature.json index 9fcee55..76316b6 100644 --- a/src/bash-aliases/devcontainer-feature.json +++ b/src/bash-aliases/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "bash-aliases", - "version": "1.0.0", + "version": "1.0.1", "name": "Bash Aliases", "description": "Loads custom bash aliases from your project's `.devcontainer/etc/bash-aliases` directory.", "installsAfter": [ diff --git a/src/uv/devcontainer-feature.json b/src/uv/devcontainer-feature.json index 9ab34a8..e69344f 100644 --- a/src/uv/devcontainer-feature.json +++ b/src/uv/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "uv", - "version": "1.0.0", + "version": "1.0.1", "name": "UV", "description": "A fast Python package manager written in Rust. Replaces pip, poetry, virtualenv, and more.", "options": { From d035359413722714371e969cf667de5388d0d89a Mon Sep 17 00:00:00 2001 From: Daniel Loureiro Date: Sat, 7 Dec 2024 09:10:27 +0000 Subject: [PATCH 2/9] :bug: fix: ensure aliases and UV cache are loaded in CI environment --- src/bash-aliases/devcontainer-feature.json | 2 +- src/bash-aliases/install.sh | 4 ++-- src/uv/devcontainer-feature.json | 2 +- src/uv/install.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bash-aliases/devcontainer-feature.json b/src/bash-aliases/devcontainer-feature.json index 76316b6..7a9e388 100644 --- a/src/bash-aliases/devcontainer-feature.json +++ b/src/bash-aliases/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "bash-aliases", - "version": "1.0.1", + "version": "1.0.2", "name": "Bash Aliases", "description": "Loads custom bash aliases from your project's `.devcontainer/etc/bash-aliases` directory.", "installsAfter": [ diff --git a/src/bash-aliases/install.sh b/src/bash-aliases/install.sh index 2ccf1e3..576ac98 100644 --- a/src/bash-aliases/install.sh +++ b/src/bash-aliases/install.sh @@ -24,8 +24,8 @@ updaterc() { # Bash-aliases loader SNIPPET_CONTENT=$(cat <<'EOF' -# Only runs on terminal from inside the vscode editor -if [ -t 1 ] && [ "${TERM_PROGRAM}" = "vscode" ]; then +# Only runs on terminal from inside vscode editor, or in CI +if [[ ( -t 1 && "${TERM_PROGRAM}" = "vscode" ) || "${CI}" = "true" ]]; then ALIASES_FOLDER="$PWD/.devcontainer/etc/bash-aliases" # Dynamically load all *.sh files from ALIASES_FOLDER diff --git a/src/uv/devcontainer-feature.json b/src/uv/devcontainer-feature.json index e69344f..c82c39e 100644 --- a/src/uv/devcontainer-feature.json +++ b/src/uv/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "uv", - "version": "1.0.1", + "version": "1.0.2", "name": "UV", "description": "A fast Python package manager written in Rust. Replaces pip, poetry, virtualenv, and more.", "options": { diff --git a/src/uv/install.sh b/src/uv/install.sh index a3522c5..f3fff2c 100644 --- a/src/uv/install.sh +++ b/src/uv/install.sh @@ -67,7 +67,7 @@ if ! uv --version &> /dev/null ; then check_packages curl unzip tar ca-certificates UV_CACHE_SCRIPT="$(cat << 'EOF' -if [ -t 1 ] && [ "${TERM_PROGRAM}" = "vscode" ]; then +if [[ ( -t 1 && "${TERM_PROGRAM}" = "vscode" ) || "${CI}" = "true" ]]; then export UV_CACHE_DIR="$PWD/.uv_cache" mkdir -p "$UV_CACHE_DIR" fi From ff738cace9c5700d11b8496f452b77779e5839da Mon Sep 17 00:00:00 2001 From: Daniel Loureiro Date: Sat, 7 Dec 2024 10:58:48 +0000 Subject: [PATCH 3/9] =?UTF-8?q?=F0=9F=90=9B=20fix:=20replace=20'installAft?= =?UTF-8?q?er'=20with=20'dependsOn'=20for=20correct=20dependency=20resolut?= =?UTF-8?q?ion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated 'devcontainer-feature.json' for 'bash-aliases' and 'uv' features to use 'dependsOn' instead of 'installAfter' to ensure hard dependencies are correctly installed. --- src/bash-aliases/devcontainer-feature.json | 8 ++++---- src/uv/devcontainer-feature.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bash-aliases/devcontainer-feature.json b/src/bash-aliases/devcontainer-feature.json index 7a9e388..c970b3d 100644 --- a/src/bash-aliases/devcontainer-feature.json +++ b/src/bash-aliases/devcontainer-feature.json @@ -1,9 +1,9 @@ { "id": "bash-aliases", - "version": "1.0.2", + "version": "1.0.3", "name": "Bash Aliases", "description": "Loads custom bash aliases from your project's `.devcontainer/etc/bash-aliases` directory.", - "installsAfter": [ - "ghcr.io/devcontainers/features/common-utils" - ] + "dependsOn": { + "ghcr.io/devcontainers/features/common-utils": {} + } } \ No newline at end of file diff --git a/src/uv/devcontainer-feature.json b/src/uv/devcontainer-feature.json index c82c39e..f8c872b 100644 --- a/src/uv/devcontainer-feature.json +++ b/src/uv/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "uv", - "version": "1.0.2", + "version": "1.0.3", "name": "UV", "description": "A fast Python package manager written in Rust. Replaces pip, poetry, virtualenv, and more.", "options": { @@ -13,7 +13,7 @@ "description": "Select or enter an UV version." } }, - "installsAfter": [ - "ghcr.io/devcontainers/features/common-utils" - ] + "dependsOn": { + "ghcr.io/devcontainers/features/common-utils": {} + } } \ No newline at end of file From 947d126cdc439113057a2b35d16fd06109e5879a Mon Sep 17 00:00:00 2001 From: Daniel Loureiro Date: Sat, 7 Dec 2024 11:08:09 +0000 Subject: [PATCH 4/9] :bug: fix: replace 'bash -ic' with 'bash -lc' in tests for better compatibility in CI Updated the test script to use 'bash -lc' instead of 'bash -ic' to ensure the aliases are loaded correctly in the CI environment. --- test/bash-aliases/test.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/bash-aliases/test.sh b/test/bash-aliases/test.sh index e9ff9f7..854a207 100644 --- a/test/bash-aliases/test.sh +++ b/test/bash-aliases/test.sh @@ -15,15 +15,15 @@ mkdir -p "$PWD/.devcontainer/etc/bash-aliases" echo "alias testalias='echo Hello, World!'" > "$PWD/.devcontainer/etc/bash-aliases/test-aliases.sh" # Feature-specific tests -check "alias is loaded" bash -ic "alias testalias | grep 'echo Hello, World!'" -check "alias works" bash -ic "testalias | grep 'Hello, World!'" +check "alias is loaded" bash -lc "alias testalias | grep 'echo Hello, World!'" +check "alias works" bash -lc "testalias | grep 'Hello, World!'" # Test when there's no bash-aliases directory. rm -rf "$PWD/.devcontainer/etc/bash-aliases" -check "no bash-aliases directory" bash -ic "echo 'No errors'" +check "no bash-aliases directory" bash -lc "echo 'No errors'" # "testalias" alias should not be available anymore -check "alias is not loaded" bash -ic "alias testalias 2>&1 | grep 'not found'" +check "alias is not loaded" bash -lc "alias testalias 2>&1 | grep 'not found'" # Report result reportResults \ No newline at end of file From c68c0810a0890660bc830934176da2c5a007e7b0 Mon Sep 17 00:00:00 2001 From: Daniel Loureiro Date: Sat, 7 Dec 2024 12:07:55 +0000 Subject: [PATCH 5/9] :rewind: revert: revert 'bash -lc' changes and comment out problematic test Reverted the changes from 'bash -lc' back to 'bash -ic' and commented out a test that may be causing issues in the CI environment. --- test/bash-aliases/test.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/bash-aliases/test.sh b/test/bash-aliases/test.sh index 854a207..16bbc3b 100644 --- a/test/bash-aliases/test.sh +++ b/test/bash-aliases/test.sh @@ -15,15 +15,15 @@ mkdir -p "$PWD/.devcontainer/etc/bash-aliases" echo "alias testalias='echo Hello, World!'" > "$PWD/.devcontainer/etc/bash-aliases/test-aliases.sh" # Feature-specific tests -check "alias is loaded" bash -lc "alias testalias | grep 'echo Hello, World!'" -check "alias works" bash -lc "testalias | grep 'Hello, World!'" +check "alias is loaded" bash -ic "alias testalias | grep 'echo Hello, World!'" +check "alias works" bash -ic "testalias | grep 'Hello, World!'" # Test when there's no bash-aliases directory. rm -rf "$PWD/.devcontainer/etc/bash-aliases" -check "no bash-aliases directory" bash -lc "echo 'No errors'" +check "no bash-aliases directory" bash -ic "echo 'No errors'" # "testalias" alias should not be available anymore -check "alias is not loaded" bash -lc "alias testalias 2>&1 | grep 'not found'" +# check "alias is not loaded" bash -ic "alias testalias 2>&1 | grep 'not found'" # Report result reportResults \ No newline at end of file From 490ec07d34ce2317b2081c62952e2e6b88eb95a6 Mon Sep 17 00:00:00 2001 From: Daniel Loureiro Date: Sat, 7 Dec 2024 12:11:21 +0000 Subject: [PATCH 6/9] :bug: debug: comment out 'set -e' to capture error messages in CI Commented out 'set -e' in the test script to capture error messages and debug the issue in the CI environment. --- test/bash-aliases/test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/bash-aliases/test.sh b/test/bash-aliases/test.sh index 16bbc3b..696d2ef 100644 --- a/test/bash-aliases/test.sh +++ b/test/bash-aliases/test.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -e +# set -e # Import test library bundled with the devcontainer CLI source dev-container-features-test-lib From 677d58c05769df994524c9a5300900eaa462e58d Mon Sep 17 00:00:00 2001 From: Daniel Loureiro Date: Sat, 7 Dec 2024 12:14:37 +0000 Subject: [PATCH 7/9] :bug: debug: switch back to 'bash -lc' to capture different error messages in CI Switched back to 'bash -lc' in the test script to capture different error messages and debug the issue in the CI environment. --- test/bash-aliases/test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/bash-aliases/test.sh b/test/bash-aliases/test.sh index 696d2ef..22cabc4 100644 --- a/test/bash-aliases/test.sh +++ b/test/bash-aliases/test.sh @@ -15,12 +15,12 @@ mkdir -p "$PWD/.devcontainer/etc/bash-aliases" echo "alias testalias='echo Hello, World!'" > "$PWD/.devcontainer/etc/bash-aliases/test-aliases.sh" # Feature-specific tests -check "alias is loaded" bash -ic "alias testalias | grep 'echo Hello, World!'" -check "alias works" bash -ic "testalias | grep 'Hello, World!'" +check "alias is loaded" bash -lc "alias testalias | grep 'echo Hello, World!'" +check "alias works" bash -lc "testalias | grep 'Hello, World!'" # Test when there's no bash-aliases directory. rm -rf "$PWD/.devcontainer/etc/bash-aliases" -check "no bash-aliases directory" bash -ic "echo 'No errors'" +check "no bash-aliases directory" bash -lc "echo 'No errors'" # "testalias" alias should not be available anymore # check "alias is not loaded" bash -ic "alias testalias 2>&1 | grep 'not found'" From f9516d93675cb763869f3dd1611a770994d7972e Mon Sep 17 00:00:00 2001 From: Daniel Loureiro Date: Sat, 7 Dec 2024 12:30:18 +0000 Subject: [PATCH 8/9] :recycle: refactor: split test file into setup and cases, reload rc file Refactored the test script by splitting it into setup and cases. Reloaded the rc file after setup instead of relying on 'bash -lc' for better compatibility. --- test/bash-aliases/cases.sh | 12 ++++++++++++ test/bash-aliases/setup.sh | 18 ++++++++++++++++++ test/bash-aliases/test.sh | 24 ++---------------------- 3 files changed, 32 insertions(+), 22 deletions(-) create mode 100644 test/bash-aliases/cases.sh create mode 100644 test/bash-aliases/setup.sh diff --git a/test/bash-aliases/cases.sh b/test/bash-aliases/cases.sh new file mode 100644 index 0000000..7c3ff30 --- /dev/null +++ b/test/bash-aliases/cases.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Feature-specific tests +check "alias is loaded" alias testalias | grep 'echo Hello, World!' +check "alias works" testalias | grep 'Hello, World!' + +# Test when there's no bash-aliases directory. +# rm -rf "$PWD/.devcontainer/etc/bash-aliases" +# check "no bash-aliases directory" bash -ic "echo 'No errors'" + +# "testalias" alias should not be available anymore +# check "alias is not loaded" bash -ic "alias testalias 2>&1 | grep 'not found'" diff --git a/test/bash-aliases/setup.sh b/test/bash-aliases/setup.sh new file mode 100644 index 0000000..42e940b --- /dev/null +++ b/test/bash-aliases/setup.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Simulate VS Code terminal by setting TERM_PROGRAM +export TERM_PROGRAM="vscode" + +# Create the bash-aliases directory +mkdir -p "$PWD/.devcontainer/etc/bash-aliases" + +# Create a test alias file +echo "alias testalias='echo Hello, World!'" > "$PWD/.devcontainer/etc/bash-aliases/test-aliases.sh" + +# Reload RC +if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then + echo -e "$1" >> /etc/bash.bashrc +fi +if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then + echo -e "$1" >> /etc/zsh/zshrc +fi diff --git a/test/bash-aliases/test.sh b/test/bash-aliases/test.sh index 22cabc4..035f1aa 100644 --- a/test/bash-aliases/test.sh +++ b/test/bash-aliases/test.sh @@ -1,29 +1,9 @@ #!/bin/bash -# set -e - -# Import test library bundled with the devcontainer CLI source dev-container-features-test-lib -# Simulate VS Code terminal by setting TERM_PROGRAM -export TERM_PROGRAM="vscode" - -# Create the bash-aliases directory -mkdir -p "$PWD/.devcontainer/etc/bash-aliases" - -# Create a test alias file -echo "alias testalias='echo Hello, World!'" > "$PWD/.devcontainer/etc/bash-aliases/test-aliases.sh" - -# Feature-specific tests -check "alias is loaded" bash -lc "alias testalias | grep 'echo Hello, World!'" -check "alias works" bash -lc "testalias | grep 'Hello, World!'" - -# Test when there's no bash-aliases directory. -rm -rf "$PWD/.devcontainer/etc/bash-aliases" -check "no bash-aliases directory" bash -lc "echo 'No errors'" +source ./setup.sh -# "testalias" alias should not be available anymore -# check "alias is not loaded" bash -ic "alias testalias 2>&1 | grep 'not found'" +source ./cases.sh -# Report result reportResults \ No newline at end of file From 19ec242132822220ebd233e57d35df8762d86f0d Mon Sep 17 00:00:00 2001 From: Daniel Loureiro Date: Sun, 8 Dec 2024 18:56:42 +0000 Subject: [PATCH 9/9] :recycle: refactor(test): restructure test suite for improved alias testing - Split `test.sh` into modular components: - `test.sh` now contains non-user-defined code. - Added `setup.sh` for testing setup, which runs once per `devcontainer features test` execution. - Created `cases/` directory for test cases, each testing a group of related features. - Introduced `cases/__before.sh` to run before every test case. - Updated test cases to properly test aliases: - Resolved issue where `check` command did not work directly with aliases. - Modified tests to use `echo "$(alias_command)"` or `zsh -ic alias_command`. This refactoring enhances the test suite structure and improves reliability when testing aliases with the `check` function. --- test/bash-aliases/cases.sh | 12 ------ test/bash-aliases/cases/00-test-setup.sh | 24 ++++++++++++ test/bash-aliases/cases/10-test-alias.sh | 11 ++++++ .../cases/20-test-no-aliases-folder.sh | 19 ++++++++++ test/bash-aliases/cases/__before.sh | 13 +++++++ test/bash-aliases/setup.sh | 21 +++------- test/bash-aliases/stubs/testalias.sh | 1 + test/bash-aliases/test.sh | 38 +++++++++++++++++-- 8 files changed, 108 insertions(+), 31 deletions(-) delete mode 100644 test/bash-aliases/cases.sh create mode 100644 test/bash-aliases/cases/00-test-setup.sh create mode 100644 test/bash-aliases/cases/10-test-alias.sh create mode 100644 test/bash-aliases/cases/20-test-no-aliases-folder.sh create mode 100644 test/bash-aliases/cases/__before.sh create mode 100644 test/bash-aliases/stubs/testalias.sh diff --git a/test/bash-aliases/cases.sh b/test/bash-aliases/cases.sh deleted file mode 100644 index 7c3ff30..0000000 --- a/test/bash-aliases/cases.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# Feature-specific tests -check "alias is loaded" alias testalias | grep 'echo Hello, World!' -check "alias works" testalias | grep 'Hello, World!' - -# Test when there's no bash-aliases directory. -# rm -rf "$PWD/.devcontainer/etc/bash-aliases" -# check "no bash-aliases directory" bash -ic "echo 'No errors'" - -# "testalias" alias should not be available anymore -# check "alias is not loaded" bash -ic "alias testalias 2>&1 | grep 'not found'" diff --git a/test/bash-aliases/cases/00-test-setup.sh b/test/bash-aliases/cases/00-test-setup.sh new file mode 100644 index 0000000..a13db37 --- /dev/null +++ b/test/bash-aliases/cases/00-test-setup.sh @@ -0,0 +1,24 @@ +#!/bin/zsh + +set -euo pipefail + +# Import test library bundled with the devcontainer CLI +source dev-container-features-test-lib + +# Info about the environment +check "Environment Info" echo "\ + PWD: $PWD\n\ + USER: $USER\n\ + HOME: $HOME\n\ + TERM_PROGRAM: $TERM_PROGRAM\n\ + CI: $CI\n\ + ALIASES_DIR: $ALIASES_DIR\n" + +# Environment Vars +check "TERM_PROGRAM is vscode" test "$TERM_PROGRAM" = "vscode" +check "CI is true" test "$CI" = "true" +check "ALIASES_DIR is set" test -n "$ALIASES_DIR" + +# Aliases directory +check "aliases directory" ls -lha "$ALIASES_DIR" +check "testalias.sh" cat "$ALIASES_DIR/testalias.sh" diff --git a/test/bash-aliases/cases/10-test-alias.sh b/test/bash-aliases/cases/10-test-alias.sh new file mode 100644 index 0000000..ef44764 --- /dev/null +++ b/test/bash-aliases/cases/10-test-alias.sh @@ -0,0 +1,11 @@ +#!/bin/zsh + +set -euo pipefail + +# Import test library bundled with the devcontainer CLI +source dev-container-features-test-lib + +# Tests +check "testalias exists" command -v testalias +check "testalias works" echo "$(testalias)" +check "testalias result" test "$(testalias)" = 'Hello, World!' diff --git a/test/bash-aliases/cases/20-test-no-aliases-folder.sh b/test/bash-aliases/cases/20-test-no-aliases-folder.sh new file mode 100644 index 0000000..357284d --- /dev/null +++ b/test/bash-aliases/cases/20-test-no-aliases-folder.sh @@ -0,0 +1,19 @@ +#!/bin/zsh + +set -euo pipefail + +# Import test library bundled with the devcontainer CLI +source dev-container-features-test-lib + +# Tests before removing aliases directory +check "directory exists" ls -lha "$ALIASES_DIR" +check "testalias exists" zsh -ic "command -v testalias" +check "testalias works" zsh -ic "testalias" +check "testalias result" zsh -ic "test \"\$(testalias)\" = 'Hello, World!'" + +# Remove aliases directory +rm -rf "$ALIASES_DIR" + +# Tests after removing aliases directory +check "directory should NOT exist" test ! -d "$ALIASES_DIR" +check "testalias should NOT exist" test ! -n "$(zsh -ic 'command -v testalias')" diff --git a/test/bash-aliases/cases/__before.sh b/test/bash-aliases/cases/__before.sh new file mode 100644 index 0000000..a3c093e --- /dev/null +++ b/test/bash-aliases/cases/__before.sh @@ -0,0 +1,13 @@ +#!/bin/zsh + +## +# This file runs before each test case. +## + +# Exit on error +set -euo pipefail + +# Create aliases directory +export ALIASES_DIR="$PWD/.devcontainer/etc/bash-aliases" +rm -Rf "$ALIASES_DIR" && mkdir -p "$ALIASES_DIR" +cp ./stubs/* "$ALIASES_DIR" diff --git a/test/bash-aliases/setup.sh b/test/bash-aliases/setup.sh index 42e940b..d889651 100644 --- a/test/bash-aliases/setup.sh +++ b/test/bash-aliases/setup.sh @@ -1,18 +1,7 @@ -#!/bin/bash +#!/bin/zsh -# Simulate VS Code terminal by setting TERM_PROGRAM -export TERM_PROGRAM="vscode" - -# Create the bash-aliases directory -mkdir -p "$PWD/.devcontainer/etc/bash-aliases" +set -euo pipefail -# Create a test alias file -echo "alias testalias='echo Hello, World!'" > "$PWD/.devcontainer/etc/bash-aliases/test-aliases.sh" - -# Reload RC -if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then - echo -e "$1" >> /etc/bash.bashrc -fi -if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then - echo -e "$1" >> /etc/zsh/zshrc -fi +# Simulate VS Code terminal and CI environment +export TERM_PROGRAM="vscode" +export CI="true" diff --git a/test/bash-aliases/stubs/testalias.sh b/test/bash-aliases/stubs/testalias.sh new file mode 100644 index 0000000..7f8dfcc --- /dev/null +++ b/test/bash-aliases/stubs/testalias.sh @@ -0,0 +1 @@ +alias testalias='echo Hello, World!' diff --git a/test/bash-aliases/test.sh b/test/bash-aliases/test.sh index 035f1aa..4bd85c1 100644 --- a/test/bash-aliases/test.sh +++ b/test/bash-aliases/test.sh @@ -1,9 +1,41 @@ -#!/bin/bash +#!/bin/zsh +set -euo pipefail + +# Import test library bundled with the devcontainer CLI source dev-container-features-test-lib +# Setup source ./setup.sh -source ./cases.sh +get_title() { + local filename="$1" + + # Extract the base filename without extension + title="$(basename "$file" .sh)" + # Remove optional prefix: number and dash (e.g., "00-"), and "test-" + title="${title#*[-]}" + title="${title#test-}" + # Replace non-alphanumeric characters with spaces + title="$(echo "$title" | sed 's/[^a-zA-Z0-9]/ /g')" + # Capitalize each word + title="$(echo "$title" | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) substr($i,2)}1')" + + echo "$title" +} + +# Run test cases +for file in ./cases/*.sh; do + if [[ "$(basename "$file")" == "__before.sh" ]]; then + continue + fi + + title="$(get_title "$file")" + + source ./cases/__before.sh + + check "[$title]" zsh -i "$file" +done -reportResults \ No newline at end of file +# Report result +reportResults