#!/usr/bin/env nu
# Load one suite into an interactive nu session (no nutest runner).

def main [suite: string] {
    let repo_root = ($env.FILE_PWD | path dirname)
    let file = ($repo_root | path join "nu" "tests" $"($suite).nu")
    if not ($file | path exists) {
        print -e $"no such test file: ($file)"
        exit 1
    }
    let child_script = (
        "source '" + $file + "'\n"
        + "print 'Loaded. Custom/test commands now in scope:'\n"
        + "scope commands | where type == 'custom' | get name | each {|n| print ('  ' + $n)}\n"
        + "print 'Call one by its full name to run just that test.'"
    )
    ^nu --execute $child_script
}
