first commit

This commit is contained in:
afoucaultc 2026-06-05 13:11:08 +02:00
commit 205faf4224
5471 changed files with 973850 additions and 0 deletions

View file

@ -0,0 +1,51 @@
#!/usr/bin/env zunit
@setup {
_YSU_BUFFER=""
}
@teardown {
rm -f output.txt
}
# We work around not being able to use `run` AND test variable values by redirecting
# all output to a temporary file from which we can read.
@test 'ysu - _write_ysu_buffer before' {
YSU_MESSAGE_POSITION="before"
export _YSU_BUFFER
_write_ysu_buffer "hello world" 2> output.txt
assert $state equals 0
assert "$(< output.txt)" same_as "hello world"
assert "$_YSU_BUFFER" is_empty
}
@test 'ysu - _write_ysu_buffer after' {
YSU_MESSAGE_POSITION="after"
export _YSU_BUFFER
_write_ysu_buffer "hello world" 2> output.txt
assert $state equals 0
assert "$(< output.txt)" is_empty
assert "$_YSU_BUFFER" same_as "hello world"
}
@test 'ysu - _write_ysu_buffer invalid' {
YSU_MESSAGE_POSITION="invalid"
export _YSU_BUFFER
_write_ysu_buffer "" 2> output.txt
assert $state equals 0
expected="$(tput setaf 1)$(tput bold)Unknown value for YSU_MESSAGE_POSITION 'invalid'. "
expected+="Expected value 'before' or 'after'$(tput sgr0)\n"
assert "$(< output.txt)" same_as "$expected"
assert "$_YSU_BUFFER" is_empty
}