Files
next.orly.dev/pkg/wasm/shell/test.sh
mleku 24eef5b5a8
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
fix CORS headers and a wasm experiment
2025-11-14 19:15:50 +00:00

46 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Test script for WASM shell examples
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
echo "========================================="
echo "WASM Shell Test Suite"
echo "========================================="
echo ""
# Build first
echo "[1/4] Building WASM modules..."
./build.sh
echo ""
# Test hello.wasm
echo "[2/4] Testing hello.wasm (stdout only)..."
echo "---"
./run.sh hello.wasm
echo ""
# Test echo.wasm with piped input
echo "[3/4] Testing echo.wasm (stdin/stdout with pipe)..."
echo "---"
echo "This is a test message" | ./run.sh echo.wasm
echo ""
# Test echo.wasm with heredoc
echo "[4/4] Testing echo.wasm (stdin/stdout with heredoc)..."
echo "---"
./run.sh echo.wasm <<< "Testing heredoc input"
echo ""
echo "========================================="
echo "All tests passed!"
echo "========================================="
echo ""
echo "Try these commands:"
echo " ./run.sh hello.wasm"
echo " echo 'your text' | ./run.sh echo.wasm"
echo " ./run.sh echo.wasm # interactive mode"