mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-21 18:10:42 -04:00
Nesting was unnecessary and added 0 or negative value. So I removed the nesting.
57 lines
1.1 KiB
Plaintext
57 lines
1.1 KiB
Plaintext
let t = import "std/testing.ucg";
|
|
|
|
let script = include str "./include_example.sh";
|
|
assert {
|
|
ok = script == "#!/usr/bin/env bash
|
|
echo \"included\"",
|
|
desc = "script was successfully included",
|
|
};
|
|
let expected = "IyEvdXNyL2Jpbi9lbnYgYmFzaAplY2hvICJpbmNsdWRlZCI=";
|
|
let base64 = include b64 "./include_example.sh";
|
|
assert {
|
|
ok = base64 == expected,
|
|
desc = "base64 == expected",
|
|
};
|
|
let base64safe = include b64urlsafe "./include_example.sh";
|
|
assert {
|
|
ok = base64safe == expected,
|
|
desc = "base64safe == expected",
|
|
};
|
|
|
|
let json_conf = include json "./include_example.json";
|
|
|
|
assert t.equal{
|
|
left = json_conf.foo,
|
|
right = "bar",
|
|
};
|
|
|
|
assert t.equal{
|
|
left = json_conf.one,
|
|
right = 1,
|
|
};
|
|
|
|
assert t.equal{
|
|
left = json_conf.inner,
|
|
right = {
|
|
list = [1, true, NULL],
|
|
},
|
|
};
|
|
|
|
let yaml_conf = include yaml "./include_example.yaml";
|
|
|
|
assert t.equal{
|
|
left = yaml_conf.foo,
|
|
right = "bar",
|
|
};
|
|
|
|
assert t.equal{
|
|
left = yaml_conf.one,
|
|
right = 1,
|
|
};
|
|
|
|
assert t.equal{
|
|
left = yaml_conf.inner,
|
|
right = {
|
|
list = [1, true, NULL],
|
|
},
|
|
}; |