Files
hermenix/nu/tests/common_test.nu
T
2026-09-17 14:14:14 -04:00

39 lines
904 B
Nu

use std/assert
use std/testing *
source ../lib/common.nu
@test
def "shquote passes through a plain string" [] {
assert equal (shquote "hello") "'hello'"
}
@test
def "shquote escapes embedded single quotes" [] {
assert equal (shquote "it's here") "'it'\\''s here'"
}
@test
def "vsock-ssh-args builds the expected argv" [] {
let argv = vsock-ssh-args 77 "hermes" "hermes"
assert equal $argv [
"ssh"
"-o" "ProxyCommand=socat - VSOCK-CONNECT:77:22"
"-o" "StrictHostKeyChecking=accept-new"
"hermes@hermes"
]
}
@test
def "hermenix-version defaults to dev when unset" [] {
with-env { HERMENIX_VERSION: null } {
assert equal (hermenix-version) "dev"
}
}
@test
def "hermenix-version passes through when set" [] {
with-env { HERMENIX_VERSION: "2026.01.01-abc1234" } {
assert equal (hermenix-version) "2026.01.01-abc1234"
}
}