un-inception/tests
russell@unturf.com 252bdffca2 fix(tests): Fix GitHub Actions test failures
- bash: Add file existence check before reading
- bash: Improve exit code handling for invalid JSON results
- bash: Expand detect_language to support all 42 languages
- python: Use detect_language() instead of non-existent EXT_MAP
- python: Remove exit_on_error param that doesn't exist
- python: Replace read_file test with validate_keys existence check
2026-01-19 06:40:49 -05:00
..
integration Add unit and integration tests for all major implementations 2026-01-05 21:29:44 -05:00
unit fix(tests): Fix GitHub Actions test failures 2026-01-19 06:40:49 -05:00
AGENT_REFACTORING_INSTRUCTIONS.md Update documentation to include snapshot functions 2026-01-15 15:37:56 -05:00
fib.go Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
fib.java Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
FILES_CREATED.txt Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
INDEX.md Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
QUICKSTART.md Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
README.md Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
run_all_tests.sh Add HMAC authentication to all 42 implementations 2025-12-28 14:24:03 -05:00
run_basic_tests.sh Add HMAC authentication to all 42 implementations 2025-12-28 14:24:03 -05:00
run_compiled_tests.sh Add HMAC authentication to all 42 implementations 2025-12-28 14:24:03 -05:00
run_inception_matrix.sh Add HMAC authentication to all 42 implementations 2025-12-28 14:24:03 -05:00
run_matrix.sh Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
run_sdk_tests.sh Create comprehensive SDK testing and refactoring framework for agents 2026-01-15 14:51:32 -05:00
SDK_TESTING_GUIDE.md Update documentation to include snapshot functions 2026-01-15 15:37:56 -05:00
SUMMARY.md Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_e2e_pipeline.sh feat: Complete Python and C SDK implementations with examples and pipeline integration 2026-01-15 16:42:58 -05:00
test_full_features.sh Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_pipeline.sh test: Add comprehensive pipeline test suite and documentation 2026-01-15 15:30:36 -05:00
test_pipeline_basic.sh test: Add comprehensive pipeline test suite and documentation 2026-01-15 15:30:36 -05:00
test_pipeline_scripts.sh test: Add comprehensive pipeline test suite and documentation 2026-01-15 15:30:36 -05:00
TEST_README.md Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_sdk_library.py Create comprehensive SDK testing and refactoring framework for agents 2026-01-15 14:51:32 -05:00
test_service_lifecycle_all.sh Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_session_all.sh Fix license comment syntax for JS/TS/Lua/Elixir 2025-12-23 11:18:14 -05:00
TEST_SUMMARY.md Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_c.c Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_clj.clj Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_cob.sh Add HMAC authentication to all 42 implementations 2025-12-28 14:24:03 -05:00
test_un_cpp.cpp Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_cr.cr Fix V result redefinition and Crystal nil type error 2026-01-06 10:04:06 -05:00
test_un_d.d Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_dart.dart Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_deno.ts Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_erl.erl Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_ex.exs Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_f90.f90 Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_forth.fth Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_fs.fs Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_go.go Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_groovy.groovy Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_hs.hs Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_jl.jl Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_js.js Add HMAC authentication to all 42 implementations 2025-12-28 14:24:03 -05:00
test_un_kt.kt Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_lisp.lisp Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_lua.lua Add HMAC authentication to all 42 implementations 2025-12-28 14:24:03 -05:00
test_un_m.sh Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_ml.ml Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_nim.nim Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_php.php Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_pl.pl Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_pro.pro Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_py.py fix(tests): Fix GitHub Actions test failures 2026-01-19 06:40:49 -05:00
test_un_r.r Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_raku.raku Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_rb.rb Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_rs.rs Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_scm.scm Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_sh.sh Add HMAC authentication to all 42 implementations 2025-12-28 14:24:03 -05:00
test_un_tcl.tcl Add HMAC authentication to all 42 implementations 2025-12-28 14:24:03 -05:00
test_un_ts.ts Add HMAC authentication to all 42 implementations 2025-12-28 14:24:03 -05:00
test_un_v.v Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_un_zig.zig Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
test_validation_script.sh feat: Complete Python and C SDK implementations with examples and pipeline integration 2026-01-15 16:42:58 -05:00
TESTING_SUMMARY.md Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
TestUn.cs Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00
TestUn.java Initial commit: 42 UN CLI implementations 2025-12-23 09:57:08 -05:00

UN CLI Inception Tests

Comprehensive test suites for the UN CLI implementations in all 42+ languages.

Quick Start - Master Test Runner

The easiest way to run tests for ALL implementations:

cd /home/fox/git/unsandbox.com/cli/inception/tests

# Run all tests (unit, integration, functional)
./run_all_tests.sh

# Run only unit tests (no API key required)
./run_all_tests.sh --unit

# Run only integration tests (requires API key)
./run_all_tests.sh --integration

# Run only functional tests (requires API key)
./run_all_tests.sh --functional

# Run multiple test types
./run_all_tests.sh --unit --integration

The master test runner:

  • Tests all 42 language implementations automatically
  • Handles missing interpreters gracefully (skips with warning)
  • Provides color-coded summary table
  • Shows timing and detailed pass/fail/skip counts
  • Exits with code 0 only if ALL tests pass

Test Files

Master Test Runner

  • run_all_tests.sh - Comprehensive test runner for ALL implementations (RECOMMENDED)

Scripting Languages

  • test_un_sh.sh - Bash UN CLI tests
  • test_un_tcl.tcl - TCL UN CLI tests
  • test_un_raku.raku - Raku UN CLI tests
  • test_un_py.py - Python UN CLI tests
  • test_un_rb.rb - Ruby UN CLI tests
  • test_un_pl.pl - Perl UN CLI tests
  • test_un_lua.lua - Lua UN CLI tests
  • test_un_php.php - PHP UN CLI tests
  • test_un_js.js - JavaScript (Node.js) UN CLI tests
  • test_un_ts.ts - TypeScript (Node.js) UN CLI tests
  • test_un_deno.ts - Deno TypeScript UN CLI tests
  • test_un_groovy.groovy - Groovy UN CLI tests

Functional Languages

  • test_un_hs.hs - Haskell UN CLI tests
  • test_un_ml.ml - OCaml UN CLI tests
  • test_un_clj.clj - Clojure UN CLI tests
  • test_un_scm.scm - Scheme (Guile) UN CLI tests
  • test_un_lisp.lisp - Common Lisp (SBCL) UN CLI tests
  • test_un_erl.erl - Erlang UN CLI tests
  • test_un_ex.exs - Elixir UN CLI tests

Systems Languages

  • test_un_c.c - C UN CLI tests
  • test_un_cpp.cpp - C++ UN CLI tests
  • test_un_go.go - Go UN CLI tests
  • test_un_rs.rs - Rust UN CLI tests
  • test_un_zig.zig - Zig UN CLI tests
  • test_un_d.d - D UN CLI tests
  • test_un_nim.nim - Nim UN CLI tests
  • test_un_cr.cr - Crystal UN CLI tests
  • test_un_v.v - V UN CLI tests
  • test_un_m.sh - Objective-C UN CLI tests (shell wrapper)

JVM Languages

  • TestUn.java - Java UN CLI tests
  • TestUn.cs - C# UN CLI tests
  • test_un_kt.kt - Kotlin UN CLI tests
  • test_un_fs.fs - F# UN CLI tests

Scientific/Specialized Languages

  • test_un_jl.jl - Julia UN CLI tests
  • test_un_r.r - R UN CLI tests
  • test_un_dart.dart - Dart UN CLI tests
  • test_un_f90.f90 - Fortran UN CLI tests
  • test_un_cob.sh - COBOL UN CLI tests (shell wrapper)
  • test_un_pro.pro - Prolog UN CLI tests
  • test_un_forth.fth - Forth UN CLI tests

What Each Test Suite Covers

Each test file includes three types of tests:

  1. Unit Tests - Extension detection logic

    • Tests that 10+ file extensions map to correct language identifiers
    • Ensures .hs"haskell", .py"python", etc.
  2. Integration Tests - API connectivity

    • Creates a simple test file and runs it through the UN CLI
    • Verifies the CLI can reach api.unsandbox.com and execute code
    • Skipped if UNSANDBOX_API_KEY environment variable is not set
  3. Functional Tests - End-to-end execution

    • Runs the corresponding fib.* file from ../test/
    • Verifies output contains "fib(10) = 55"
    • Tests the full workflow: file reading → API call → output display
    • Skipped if UNSANDBOX_API_KEY environment variable is not set

Prerequisites

General

  • Set UNSANDBOX_API_KEY environment variable to run integration/functional tests
  • Run tests from /home/fox/git/unsandbox.com/cli/inception/ directory

Language-Specific Dependencies

Haskell (test_un_hs.hs):

# Install dependencies
cabal install --lib aeson http-conduit bytestring text

# Run tests
cd /home/fox/git/unsandbox.com/cli/inception/
./tests/test_un_hs.hs

OCaml (test_un_ml.ml):

# Install dependencies
opam install cohttp-lwt-unix yojson

# Run tests
cd /home/fox/git/unsandbox.com/cli/inception/
ocaml tests/test_un_ml.ml

Clojure (test_un_clj.clj):

# Install Clojure CLI tools
# Dependencies: clj-http, cheshire

# Run tests
cd /home/fox/git/unsandbox.com/cli/inception/
clj -Sdeps '{:deps {clj-http/clj-http {:mvn/version "3.12.3"} cheshire/cheshire {:mvn/version "5.11.0"}}}' -M tests/test_un_clj.clj

Scheme (test_un_scm.scm):

# Install Guile and dependencies
sudo apt-get install guile-3.0 guile-json

# Run tests
cd /home/fox/git/unsandbox.com/cli/inception/
./tests/test_un_scm.scm

Common Lisp (test_un_lisp.lisp):

# Install SBCL and Quicklisp
# In SBCL: (ql:quickload '(:dexador :jonathan))

# Run tests
cd /home/fox/git/unsandbox.com/cli/inception/
sbcl --script tests/test_un_lisp.lisp

Erlang (test_un_erl.erl):

# Install Erlang/OTP (includes inets, ssl)

# Run tests
cd /home/fox/git/unsandbox.com/cli/inception/
escript tests/test_un_erl.erl

Elixir (test_un_ex.exs):

# Elixir comes with standard library support

# Run tests
cd /home/fox/git/unsandbox.com/cli/inception/
elixir tests/test_un_ex.exs

Julia (test_un_jl.jl):

# Install dependencies
julia -e 'using Pkg; Pkg.add("HTTP"); Pkg.add("JSON")'

# Run tests
cd /home/fox/git/unsandbox.com/cli/inception/
julia tests/test_un_jl.jl

R (test_un_r.r):

# Install dependencies
R -e 'install.packages(c("httr", "jsonlite"), repos="https://cran.rstudio.com/")'

# Run tests
cd /home/fox/git/unsandbox.com/cli/inception/
Rscript tests/test_un_r.r

Crystal (test_un_cr.cr):

# Crystal stdlib includes HTTP and JSON support

# Run tests (interpreted)
cd /home/fox/git/unsandbox.com/cli/inception/
crystal tests/test_un_cr.cr

# Or compile first for faster execution
crystal build tests/test_un_cr.cr -o test_un_cr
./test_un_cr

Fortran (test_un_f90.f90):

# Compile with gfortran
cd /home/fox/git/unsandbox.com/cli/inception/
gfortran -o test_un_f90 tests/test_un_f90.f90

# Run tests
./test_un_f90
rm test_un_f90

COBOL (test_un_cob.sh):

# Install GnuCOBOL
sudo apt-get install gnucobol  # Ubuntu/Debian
# or
sudo dnf install gnucobol      # Fedora

# Run tests (shell wrapper)
cd /home/fox/git/unsandbox.com/cli/inception/
bash tests/test_un_cob.sh

Prolog (test_un_pro.pro):

# Install SWI-Prolog
sudo apt-get install swi-prolog

# Run tests
cd /home/fox/git/unsandbox.com/cli/inception/
swipl -g main -t halt tests/test_un_pro.pro

Forth (test_un_forth.fth):

# Install Gforth
sudo apt-get install gforth

# Run tests
cd /home/fox/git/unsandbox.com/cli/inception/
gforth tests/test_un_forth.fth

Running All Tests

cd /home/fox/git/unsandbox.com/cli/inception/

# Export API key (required for integration/functional tests)
export UNSANDBOX_API_KEY="your_api_key_here"

# Run each test suite
echo "=== Haskell ==="
./tests/test_un_hs.hs
echo ""

echo "=== OCaml ==="
ocaml tests/test_un_ml.ml
echo ""

echo "=== Clojure ==="
clj -Sdeps '{:deps {clj-http/clj-http {:mvn/version "3.12.3"} cheshire/cheshire {:mvn/version "5.11.0"}}}' -M tests/test_un_clj.clj
echo ""

echo "=== Scheme ==="
./tests/test_un_scm.scm
echo ""

echo "=== Common Lisp ==="
sbcl --script tests/test_un_lisp.lisp
echo ""

echo "=== Erlang ==="
escript tests/test_un_erl.erl
echo ""

echo "=== Elixir ==="
elixir tests/test_un_ex.exs
echo ""

echo "=== Julia ==="
julia tests/test_un_jl.jl
echo ""

echo "=== R ==="
Rscript tests/test_un_r.r
echo ""

echo "=== Crystal ==="
crystal tests/test_un_cr.cr
echo ""

echo "=== Fortran ==="
gfortran -o test_un_f90 tests/test_un_f90.f90 && ./test_un_f90 && rm test_un_f90
echo ""

echo "=== COBOL ==="
bash tests/test_un_cob.sh
echo ""

echo "=== Prolog ==="
swipl -g main -t halt tests/test_un_pro.pro
echo ""

echo "=== Forth ==="
gforth tests/test_un_forth.fth

Test Output

Each test suite produces color-coded output:

  • Green ✓ PASS - Test passed successfully
  • Red ✗ FAIL - Test failed with error message
  • Yellow ⚠ WARNING - API key not set, some tests skipped

Example output:

=== Haskell UN CLI Test Suite ===

✓ PASS - Extension detection
✓ PASS - API integration
✓ PASS - Fibonacci end-to-end test

✓ All tests passed (3/3)

Exit Codes

  • 0 - All tests passed
  • 1 - One or more tests failed

Debugging Failed Tests

If a test fails:

  1. Check that you're running from the correct directory (/home/fox/git/unsandbox.com/cli/inception/)
  2. Verify UNSANDBOX_API_KEY is set correctly
  3. Ensure the UN CLI implementation (un.hs, un.ml, etc.) is in the parent directory
  4. Check that test files exist in ../test/ (e.g., fib.hs, fib.ml)
  5. Review the error message - tests provide detailed failure information

Implementation Notes

  • Tests use the same extension-to-language mapping as the UN CLI implementations
  • API tests create temporary files in /tmp/
  • Tests verify both success (exit code 0) and expected output content
  • Fibonacci tests specifically look for the string "fib(10) = 55" in output
  • All tests are self-contained and can run independently