Unsandbox CLI implementations in 42 programming languages for the permacomputer project. Public domain software for code execution across all ecosystems. Languages: Python, JavaScript, Ruby, Go, Rust, C, C++, Java, Kotlin, C#, F#, Haskell, OCaml, Clojure, Scheme, Common Lisp, Erlang, Elixir, D, Nim, Zig, V, Dart, Groovy, Scala, Julia, R, Crystal, Fortran, COBOL, Prolog, Forth, Tcl, Raku, Lua, PHP, Perl, Bash, TypeScript, Objective-C, PowerShell, AWK Includes test suites and service lifecycle tests.
4.9 KiB
4.9 KiB
UN CLI Inception Tests - Summary
Created Files
Test Files (8 languages)
-
test_un_go.go (209 lines)
- Go implementation test
- Compile:
go build -o test_un_go test_un_go.go - Binary tested:
../un_go
-
test_un_rs.rs (195 lines)
- Rust implementation test
- Compile:
rustc test_un_rs.rs -o test_un_rs - Binary tested:
../un_rust - Note: Requires reqwest and serde_json for full API tests
-
test_un_c.c (220 lines)
- C implementation test
- Compile:
gcc -o test_un_c test_un_c.c -lcurl - Binary tested:
../un_c
-
test_un_cpp.cpp (210 lines)
- C++ implementation test
- Compile:
g++ -o test_un_cpp test_un_cpp.cpp -lcurl - Binary tested:
../un_cpp
-
test_un_d.d (175 lines)
- D implementation test
- Compile:
dmd test_un_d.d -of=test_un_d - Binary tested:
../un_d
-
test_un_zig.zig (235 lines)
- Zig implementation test
- Compile:
zig build-exe test_un_zig.zig -O ReleaseFast - Binary tested:
../un
-
test_un_nim.nim (130 lines)
- Nim implementation test
- Compile:
nim c -d:release test_un_nim.nim - Binary tested:
../un
-
test_un_v.v (145 lines)
- V implementation test
- Compile:
v test_un_v.v -o test_un_v - Binary tested:
../un_v
Support Files
-
fib.go (15 lines)
- Test program for functional tests
- Computes Fibonacci(10) = 55
- Used by all test suites
-
TEST_README.md
- Comprehensive documentation
- Usage instructions for all tests
- Troubleshooting guide
- CI/CD examples
-
SUMMARY.md (this file)
- Overview of created files
- Quick reference
Test Coverage
Each test file includes:
1. Unit Tests - Extension Detection
Tests 11 file extensions:
.py→python.js→javascript.go→go.rs→rust.c→c.cpp→cpp.d→d.zig→zig.nim→nim.v→v.xyz→null(unknown extension)
2. Integration Tests - API Connection
- Creates JSON request:
{"language":"python","code":"print('Hello from API test')"} - POSTs to
https://api.unsandbox.com/execute - Validates response contains expected output
- Skips gracefully if
UNSANDBOX_API_KEYnot set
3. Functional Tests - End-to-End
- Executes the UN CLI binary with
fib.go - Verifies output contains
fib(10) = 55 - Tests actual file I/O, API calls, and output parsing
- Skips if binary not built or API key not set
Test Behavior
Success Cases
- All tests pass → Exit code 0
- Skipped tests (no API key, no binary) → Exit code 0
Failure Cases
- Extension detection wrong → Exit code 1
- API connection fails → Exit code 1
- Functional test fails → Exit code 1
Quick Start
# Set API key
export UNSANDBOX_API_KEY="your-key-here"
# Build UN CLI implementation (example: Go)
cd /home/fox/git/unsandbox.com/cli/inception
go build -o un_go un.go
# Build and run tests
cd tests
go build -o test_un_go test_un_go.go
./test_un_go
Verification
The Go test was successfully compiled and executed:
UN CLI Go Implementation Test Suite
====================================
=== Test 1: Extension Detection ===
PASS: script.py -> python
PASS: app.js -> javascript
PASS: main.go -> go
PASS: program.rs -> rust
PASS: code.c -> c
PASS: app.cpp -> cpp
PASS: prog.d -> d
PASS: main.zig -> zig
PASS: script.nim -> nim
PASS: app.v -> v
PASS: unknown.xyz ->
Extension Detection: 11 passed, 0 failed
=== Test 2: API Connection ===
SKIP: UNSANDBOX_API_KEY not set
API Connection: skipped
=== Test 3: Functional Test (fib.go) ===
SKIP: UNSANDBOX_API_KEY not set
Functional Test: skipped
====================================
RESULT: ALL TESTS PASSED
File Locations
All files created in: /home/fox/git/unsandbox.com/cli/inception/tests/
tests/
├── fib.go # Test program
├── test_un_go.go # Go tests
├── test_un_rs.rs # Rust tests
├── test_un_c.c # C tests
├── test_un_cpp.cpp # C++ tests
├── test_un_d.d # D tests
├── test_un_zig.zig # Zig tests
├── test_un_nim.nim # Nim tests
├── test_un_v.v # V tests
├── TEST_README.md # Full documentation
└── SUMMARY.md # This file
Total Lines of Code
Approximately 1,733 lines of test code across 8 test files.
Next Steps
- Build the UN CLI implementations you want to test
- Set your
UNSANDBOX_API_KEYenvironment variable - Compile and run the test files
- Review TEST_README.md for detailed instructions
Contributing
To add tests for new UN CLI implementations:
- Copy the structure from an existing test file
- Adapt to the new language's syntax and conventions
- Ensure all 3 test types are included
- Update TEST_README.md with compilation instructions
- Test locally before committing
License
These tests are part of the unsandbox.com project.