✓
Passing This code compiles and runs correctly.
Code
// Test 647: deps:requires.system - System dependency declarations
//
// This test validates that system-level dependencies can be declared
// and checked via the deps command.
//
// Run: koruc input.kz deps
// Expected: Shows status of declared system dependencies
~import std/deps
// Declare system dependencies using Source blocks (like requires.npm)
~std/deps:requires.system {
"name": "curl",
"check": "curl-config --version",
"brew": "curl",
"apt": "libcurl4-openssl-dev",
"dnf": "libcurl-devel",
"pacman": "curl"
}
~std/deps:requires.system {
"name": "zlib",
"check": "pkg-config --modversion zlib",
"brew": "zlib",
"apt": "zlib1g-dev",
"dnf": "zlib-devel",
"pacman": "zlib"
}
// A fake dependency that won't be installed (for testing missing deps)
~std/deps:requires.system {
"name": "nonexistent-lib",
"check": "nonexistent-check-command --version",
"brew": "nonexistent-brew-pkg",
"apt": "nonexistent-apt-pkg"
}
~tor main {}
~proc main|zig {
}
~main()
Flows
flow ~requires.system click a branch to expand · @labels scroll to their anchor
requires.system (source: "name": "curl",
"check": "curl-config --version",
"brew": "curl",
"apt": "libcurl4-openssl-dev",
"dnf": "libcurl-devel",
"pacman": "curl")
flow ~requires.system click a branch to expand · @labels scroll to their anchor
requires.system (source: "name": "zlib",
"check": "pkg-config --modversion zlib",
"brew": "zlib",
"apt": "zlib1g-dev",
"dnf": "zlib-devel",
"pacman": "zlib")
flow ~requires.system click a branch to expand · @labels scroll to their anchor
requires.system (source: "name": "nonexistent-lib",
"check": "nonexistent-check-command --version",
"brew": "nonexistent-brew-pkg",
"apt": "nonexistent-apt-pkg")
flow ~main click a branch to expand · @labels scroll to their anchor
main
Test Configuration
Post-validation Script:
#!/bin/bash
# `deps` must REPORT the declarations, not merely exit cleanly.
#
# The previous form was `koruc input.kz deps || true` followed by an
# unconditional "test passed" echo — it asserted nothing, so it stayed green
# while the scan was one level deep and silently ignored imported libraries.
set -e
OUT=$(koruc input.kz deps 2>&1)
for dep in curl zlib nonexistent-lib; do
echo "$OUT" | grep -q "$dep" || { echo "FAIL: deps did not report '$dep'"; echo "$OUT"; exit 1; }
done
# The toolchain's own requirement, and exactly once — the seeded entry and
# koru_std/compiler.kz's declaration must not both surface.
ZIG_LINES=$(echo "$OUT" | grep -cE '^ +zig ' || true)
[ "$ZIG_LINES" = "1" ] || { echo "FAIL: expected 1 zig line, got $ZIG_LINES"; echo "$OUT"; exit 1; }
echo "=== Test passed: deps reported every declared dependency ==="