input: add label

This commit is contained in:
Peter McGoron 2021-07-10 16:23:56 -04:00
parent 03c7601f22
commit d258005125
1 changed files with 19 additions and 0 deletions

View File

@ -126,6 +126,24 @@ TEST two_in_one(void) {
PASS();
}
TEST label(void) {
struct libscomm_input in;
struct libscomm_line l;
char s[] = ":N a m e\tArg 1\tArg 2\tArg 3\n";
char *p = s;
libscomm_reset(&in);
ASSERT_EQ(libscomm_read(&in, &p, &l), LIBSCOMM_COMPLETE);
ASSERT_EQ(l.name, 1);
ASSERT_EQ(l.len, 4);
ASSERT_STR_EQ(l.buf[0], ":N a m e");
ASSERT_STR_EQ(l.buf[1], "Arg 1");
ASSERT_STR_EQ(l.buf[2], "Arg 2");
ASSERT_STR_EQ(l.buf[3], "Arg 3");
PASS();
}
GREATEST_MAIN_DEFS();
int main(int argc, char *argv[]) {
@ -137,6 +155,7 @@ int main(int argc, char *argv[]) {
RUN_TEST(arg_limit);
RUN_TEST(too_many_arg);
RUN_TEST(two_in_one);
RUN_TEST(label);
GREATEST_MAIN_END();
}