Permalink
Browse files

Merge tests/command/lookup.c fix from master

  • Loading branch information...
2 parents 68df01d + a25c120 commit d08de4a06d997e9d5e96de9a33e45cfcda87dbd9 myshkin committed May 11, 2012
Showing with 25 additions and 10 deletions.
  1. +25 −10 src/tests/command/lookup.c
View
@@ -10,6 +10,7 @@
#include "object/obj-flag.h"
#include "object/object.h"
#include "cmds.h"
+#include "keymap.h"
#include "ui-event.h"
#include "z-virt.h"
@@ -25,21 +26,35 @@ int teardown_tests(void *state) {
}
/* Regression test for #1330 */
-int test_cmd_lookup(void *state) {
- require(cmd_lookup('Z') == CMD_NULL);
- require(cmd_lookup('{') == CMD_INSCRIBE);
- require(cmd_lookup('u') == CMD_USE_STAFF);
- require(cmd_lookup('T') == CMD_TUNNEL);
- require(cmd_lookup('g') == CMD_PICKUP);
- require(cmd_lookup('G') == CMD_STUDY_BOOK);
- require(cmd_lookup(KTRL('S')) == CMD_SAVE);
- require(cmd_lookup('+') == CMD_ALTER);
+int test_cmd_lookup_orig(void *state) {
+ require(cmd_lookup('Z', KEYMAP_MODE_ORIG) == CMD_NULL);
+ require(cmd_lookup('{', KEYMAP_MODE_ORIG) == CMD_INSCRIBE);
+ require(cmd_lookup('u', KEYMAP_MODE_ORIG) == CMD_USE_STAFF);
+ require(cmd_lookup('T', KEYMAP_MODE_ORIG) == CMD_TUNNEL);
+ require(cmd_lookup('g', KEYMAP_MODE_ORIG) == CMD_PICKUP);
+ require(cmd_lookup('G', KEYMAP_MODE_ORIG) == CMD_STUDY_BOOK);
+ require(cmd_lookup(KTRL('S'), KEYMAP_MODE_ORIG) == CMD_SAVE);
+ require(cmd_lookup('+', KEYMAP_MODE_ORIG) == CMD_ALTER);
+
+ ok;
+}
+
+/* Introduced after commit 8871070 added modes to cmd_lookup() calls */
+int test_cmd_lookup_rogue(void *state) {
+ require(cmd_lookup('{', KEYMAP_MODE_ROGUE) == CMD_INSCRIBE);
+ require(cmd_lookup('Z', KEYMAP_MODE_ROGUE) == CMD_USE_STAFF);
+ require(cmd_lookup(KTRL('T'), KEYMAP_MODE_ROGUE) == CMD_TUNNEL);
+ require(cmd_lookup('g', KEYMAP_MODE_ROGUE) == CMD_PICKUP);
+ require(cmd_lookup('G', KEYMAP_MODE_ROGUE) == CMD_STUDY_BOOK);
+ require(cmd_lookup(KTRL('S'), KEYMAP_MODE_ROGUE) == CMD_SAVE);
+ require(cmd_lookup('+', KEYMAP_MODE_ROGUE) == CMD_ALTER);
ok;
}
const char *suite_name = "command/lookup";
struct test tests[] = {
- { "cmd_lookup", test_cmd_lookup },
+ { "cmd_lookup_orig", test_cmd_lookup_orig },
+ { "cmd_lookup_rogue", test_cmd_lookup_rogue },
{ NULL, NULL }
};

0 comments on commit d08de4a

Please sign in to comment.