"in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat " \
"non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
-static void test_default_term_for_tty(void) {
- log_info("/* %s */", __func__);
-
+TEST(default_term_for_tty) {
puts(default_term_for_tty("/dev/tty23"));
puts(default_term_for_tty("/dev/ttyS23"));
puts(default_term_for_tty("/dev/tty0"));
puts(default_term_for_tty("console"));
}
-static void test_read_one_char(void) {
+TEST(read_one_char) {
_cleanup_fclose_ FILE *file = NULL;
char r;
bool need_nl;
char name[] = "/tmp/test-read_one_char.XXXXXX";
- log_info("/* %s */", __func__);
-
assert_se(fmkostemp_safe(name, "r+", &file) == 0);
assert_se(fputs("c\n", file) >= 0);
assert_se(unlink(name) >= 0);
}
-static void test_getttyname_malloc(void) {
+TEST(getttyname_malloc) {
_cleanup_free_ char *ttyname = NULL;
_cleanup_close_ int master = -1;
- log_info("/* %s */", __func__);
-
assert_se((master = posix_openpt(O_RDWR|O_NOCTTY)) >= 0);
assert_se(getttyname_malloc(master, &ttyname) >= 0);
log_info("ttyname = %s", ttyname);
{ "highlight-grey-underline", ansi_highlight_grey_underline },
};
-static void test_colors(void) {
- log_info("/* %s */", __func__);
-
+TEST(colors) {
for (size_t i = 0; i < ELEMENTSOF(colors); i++)
printf("<%s%s%s>\n", colors[i].func(), colors[i].name, ansi_normal());
}
-static void test_text(void) {
- log_info("/* %s */", __func__);
-
+TEST(text) {
for (size_t i = 0; !streq(colors[i].name, "underline"); i++) {
bool blwh = strstr(colors[i].name, "black")
|| strstr(colors[i].name, "white");
}
}
-static void test_get_ctty(void) {
+TEST(get_ctty) {
_cleanup_free_ char *ctty = NULL;
struct stat st;
dev_t devnr;
log_notice("Not invoked with stdin == ctty, cutting get_ctty() test short");
}
-int main(int argc, char *argv[]) {
- test_setup_logging(LOG_INFO);
-
- test_default_term_for_tty();
- test_read_one_char();
- test_getttyname_malloc();
- test_colors();
- test_text();
- test_get_ctty();
-
- return 0;
-}
+DEFINE_TEST_MAIN(LOG_INFO);