diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/filecomp.c | 9 | ||||
-rw-r--r-- | test/rulescomp.c | 7 | ||||
-rw-r--r-- | test/stringcomp.c | 10 |
3 files changed, 26 insertions, 0 deletions
diff --git a/test/filecomp.c b/test/filecomp.c index 0c1111a..eafe568 100644 --- a/test/filecomp.c +++ b/test/filecomp.c @@ -48,6 +48,15 @@ main(void) assert(!test_file(ctx, "keymaps/bad.xkb")); assert(!test_file(ctx, "does not exist")); + /* Test response to invalid flags and formats. */ + fclose(stdin); + assert(!xkb_keymap_new_from_file(ctx, NULL, XKB_KEYMAP_FORMAT_TEXT_V1, 0)); + assert(!xkb_keymap_new_from_file(ctx, stdin, 0, 0)); + assert(!xkb_keymap_new_from_file(ctx, stdin, XKB_KEYMAP_USE_ORIGINAL_FORMAT, 0)); + assert(!xkb_keymap_new_from_file(ctx, stdin, 1234, 0)); + assert(!xkb_keymap_new_from_file(ctx, stdin, XKB_KEYMAP_FORMAT_TEXT_V1, -1)); + assert(!xkb_keymap_new_from_file(ctx, stdin, XKB_KEYMAP_FORMAT_TEXT_V1, 1234)); + xkb_context_unref(ctx); return 0; diff --git a/test/rulescomp.c b/test/rulescomp.c index 7318f75..55113f6 100644 --- a/test/rulescomp.c +++ b/test/rulescomp.c @@ -118,5 +118,12 @@ int main(int argc, char *argv[]) assert(!test_rmlvo(ctx, "does-not-exist", "", "", "", "")); + /* Test response to invalid flags. */ + { + struct xkb_rule_names rmlvo = { NULL }; + assert(!xkb_keymap_new_from_names(ctx, &rmlvo, -1)); + assert(!xkb_keymap_new_from_names(ctx, &rmlvo, 5453)); + } + xkb_context_unref(ctx); } diff --git a/test/stringcomp.c b/test/stringcomp.c index 7d13340..ab5bbef 100644 --- a/test/stringcomp.c +++ b/test/stringcomp.c @@ -81,6 +81,16 @@ main(int argc, char *argv[]) xkb_keymap_unref(keymap); keymap = test_compile_string(ctx, dump); assert(keymap); + + /* Test response to invalid formats and flags. */ + assert(!xkb_keymap_new_from_string(ctx, dump, 0, 0)); + assert(!xkb_keymap_new_from_string(ctx, dump, -1, 0)); + assert(!xkb_keymap_new_from_string(ctx, dump, XKB_KEYMAP_FORMAT_TEXT_V1+1, 0)); + assert(!xkb_keymap_new_from_string(ctx, dump, XKB_KEYMAP_FORMAT_TEXT_V1, -1)); + assert(!xkb_keymap_new_from_string(ctx, dump, XKB_KEYMAP_FORMAT_TEXT_V1, 1414)); + assert(!xkb_keymap_get_as_string(keymap, 0)); + assert(!xkb_keymap_get_as_string(keymap, 4893)); + xkb_keymap_unref(keymap); free(dump); |