logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: bc597dbdae4518615afb337847d525e39531959f
parent f275122c80c6c4c4ed9c85c915ece89c39b634b1
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue,  8 Jun 2021 06:19:03 +0200

false,true: New programs

Diffstat:

M.gitignore7+++++--
Mbin/Makefile.config2+-
Abin/false.c5+++++
Abin/true.c5+++++
Mtest-bin/Kyuafile3+++
Atest-bin/false22++++++++++++++++++++++
Atest-bin/true22++++++++++++++++++++++
7 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,8 +1,11 @@ -/bin +/bin/* !/bin/*.c !/bin/*.sh !/bin/*.1 -/sbin +/sbin/* !/sbin/*.c !/sbin/*.sh !/sbin/*.1 + +# Kyua +/html/ diff --git a/bin/Makefile.config b/bin/Makefile.config @@ -1,2 +1,2 @@ -EXE = args basename date del dirname echo humanize lolcat mdate pwd range sizeof sname tty xcd +EXE = args basename date del dirname echo false humanize lolcat mdate pwd range sizeof sname true tty xcd MAN1 = basename.1 date.1 del.1 dirname.1 humanize.1 lolcat.1 sname.1 diff --git a/bin/false.c b/bin/false.c @@ -0,0 +1,5 @@ +int +main(void) +{ + return 1; +} diff --git a/bin/true.c b/bin/true.c @@ -0,0 +1,5 @@ +int +main(void) +{ + return 0; +} diff --git a/test-bin/Kyuafile b/test-bin/Kyuafile @@ -2,8 +2,11 @@ syntax(2) test_suite("utils") +-- /BEGIN/,$ | LC_ALL=C.UTF-8 sort atf_test_program{name="args"} atf_test_program{name="basename"} atf_test_program{name="dirname"} atf_test_program{name="sname"} +atf_test_program{name="true"} +atf_test_program{name="false"} atf_test_program{name="xcd"} diff --git a/test-bin/false b/test-bin/false @@ -0,0 +1,22 @@ +#!/usr/bin/env atf-sh +atf_test_case basic +basic_body() { + atf_check -s exit:1 ../bin/false +} + +atf_test_case nohelp +nohelp_body() { + atf_check -s exit:1 ../bin/false --help +} + +atf_test_case devfull +devfull_body() { + atf_check -s exit:1 ../bin/false --help >/dev/full +} + +atf_init_test_cases() { + cd "$(atf_get_srcdir)" + atf_add_test_case basic + atf_add_test_case nohelp + atf_add_test_case devfull +} diff --git a/test-bin/true b/test-bin/true @@ -0,0 +1,22 @@ +#!/usr/bin/env atf-sh +atf_test_case basic +basic_body() { + atf_check ../bin/true +} + +atf_test_case nohelp +nohelp_body() { + atf_check ../bin/true --help +} + +atf_test_case devfull +devfull_body() { + atf_check ../bin/true --help >/dev/full +} + +atf_init_test_cases() { + cd "$(atf_get_srcdir)" + atf_add_test_case basic + atf_add_test_case nohelp + atf_add_test_case devfull +}