commit: 9579ef40ff0c16b905a444903688f2f343ff91a6
parent: ffd482d156a0acf02656277d86e10d29d3539363
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Mon, 16 Dec 2019 03:24:30 +0100
uri_test.c: fixup
Diffstat:
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
@@ -47,7 +47,7 @@ badwolf: $(OBJS)
uri_test: uri.o uri_test.o
$(CC) -std=c11 -o $@ uri.o uri_test.o $(LDFLAGS) $(LIBS)
- ./$@
+ $(DBG) ./$@
.PHONY: test
test: $(EXE_test)
diff --git a/uri_test.c b/uri_test.c
@@ -18,17 +18,21 @@ badwolf_ensure_uri_scheme_test(void)
const gchar *text;
gboolean try_file;
} cases[] = {
- // clang formatting hack
+ //
+ {"http://uri.c", "http://uri.c", FALSE},
+ {"http://uri.c", "http://uri.c", TRUE},
+ {"file:///dev/null", "file:///dev/null", FALSE},
+ {"file:///dev/null", "file:///dev/null", TRUE},
{fallback, NULL, FALSE},
{fallback, NULL, TRUE},
{fallback, "", FALSE},
{fallback, "", TRUE},
- {fallback, "/dev/null", FALSE},
- //{"file://dev/null", "/dev/null", TRUE},
- //{"http://example.org", "example.org", FALSE},
- //{"http://example.org", "example.org", TRUE},
- //{fallback, "http://", FALSE},
- //{fallback, "http://", TRUE}
+ {"http:///dev/null", "/dev/null", FALSE},
+ {"file:///dev/null", "/dev/null", TRUE},
+ {"http://example.org", "example.org", FALSE},
+ {"http://example.org", "example.org", TRUE},
+ {"http://", "http://", FALSE},
+ {"http://", "http://", TRUE} //
};
for(size_t i = 0; i < sizeof(cases) / sizeof(cases[0]); i++)
@@ -39,7 +43,10 @@ badwolf_ensure_uri_scheme_test(void)
const gchar *got = badwolf_ensure_uri_scheme(cases[i].text, cases[i].try_file);
- if(got != cases[i].expect) g_error("expected: \"%s\", got: \"%s\"", cases[i].expect, got);
+ if(g_strcmp0(got, cases[i].expect) != 0)
+ {
+ g_error("expected: \"%s\", got: \"%s\"", cases[i].expect, got);
+ }
}
}