forked from bonsai/harakit
moved tests into test directory
This commit is contained in:
25
tests/bonsai/dj.sh
Executable file
25
tests/bonsai/dj.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
|
||||
# SPDX-License-Identifier: FSFAP
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice and this
|
||||
# notice are preserved. This file is offered as-is, without any warranty.
|
||||
|
||||
! dj -h
|
||||
|
||||
# This test is theoretically Linux-dependent; write(2) should return -1 on
|
||||
# error.
|
||||
# Right now dj(1) interprets the return value of write(2) as the amount of
|
||||
# bytes written. This can decrement the stored quantity of bytes written,
|
||||
# which is an int, so doesn't underflow but goes negative. dj(1) tries to
|
||||
# again to write(2) if an error occurs in which no bytes are written, so in
|
||||
# total two write(2)s are attempted and so the written byte quantity is -2.
|
||||
# This is a bug and will change, but for now is at least documented.
|
||||
dj -Hi /dev/zero -o /dev/full \
|
||||
| xargs -I out "$BIN/strcmp" '1+0 > 0+0; 1024 > -2' out
|
||||
|
||||
# Read nothing from /dev/null, write nothing to /dev/null.
|
||||
dj -Hi /dev/null -o /dev/null \
|
||||
| xargs -I out "$BIN/strcmp" '0+0 > 0+0; 0 > 0' out
|
||||
11
tests/bonsai/false.sh
Executable file
11
tests/bonsai/false.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
|
||||
# SPDX-License-Identifier: FSFAP
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice and this
|
||||
# notice are preserved. This file is offered as-is, without any warranty.
|
||||
|
||||
! false
|
||||
! false -h
|
||||
23
tests/bonsai/intcmp.sh
Executable file
23
tests/bonsai/intcmp.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
|
||||
# SPDX-License-Identifier: FSFAP
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice and this
|
||||
# notice are preserved. This file is offered as-is, without any warranty.
|
||||
|
||||
intcmp -e 3 3 3
|
||||
intcmp -g 3 2 1
|
||||
intcmp -l 1 2 3
|
||||
intcmp -ge 3 3 1
|
||||
intcmp -le 1 3 3
|
||||
intcmp -gl 1 2 3
|
||||
intcmp -egl 3 1 1 2
|
||||
! intcmp -e 1 2 3
|
||||
! intcmp -g 1 3 3
|
||||
! intcmp -l 3 3 1
|
||||
! intcmp -ge 1 2 3
|
||||
! intcmp -le 3 2 1
|
||||
! intcmp -gl 3 3 3
|
||||
! intcmp -egl foo
|
||||
14
tests/bonsai/strcmp.sh
Executable file
14
tests/bonsai/strcmp.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
|
||||
# SPDX-License-Identifier: FSFAP
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice and this
|
||||
# notice are preserved. This file is offered as-is, without any warranty.
|
||||
|
||||
strcmp equals equals
|
||||
! strcmp inequals equals
|
||||
strcmp - -
|
||||
strcmp -h
|
||||
! strcmp nocmp
|
||||
11
tests/bonsai/true.sh
Executable file
11
tests/bonsai/true.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
|
||||
# SPDX-License-Identifier: FSFAP
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice and this
|
||||
# notice are preserved. This file is offered as-is, without any warranty.
|
||||
|
||||
true
|
||||
true -h
|
||||
Reference in New Issue
Block a user