diff options
author | hut <hut@lavabit.com> | 2010-04-09 01:29:09 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-09 01:29:09 +0200 |
commit | 93ecd88d9ad4231ab4926c2df43e00047900cd99 (patch) | |
tree | 7cb68934d7b280a71516e851f8a9ff4fe9423331 /test | |
parent | 4537ca72633b0c60e6fd4700adb6b96c0a823c7b (diff) | |
download | ranger-93ecd88d9ad4231ab4926c2df43e00047900cd99.tar.gz |
partially fix tc_newkeys
Diffstat (limited to 'test')
-rw-r--r-- | test/tc_newkeys.py | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/test/tc_newkeys.py b/test/tc_newkeys.py index fc17aeda..9a7f10c7 100644 --- a/test/tc_newkeys.py +++ b/test/tc_newkeys.py @@ -83,31 +83,6 @@ class Test(PressTestCase): self.assert_(match.function) self.assertEqual(8, match.function(args)) - def test_map_collision(self): - def add_dirs(arg): - return sum(dir.down() for dir in arg.directions) - def return5(_): - return 5 - - - directions = KeyMap() - directions.map('gg', dir=Direction(down=1)) - - - km = KeyMap() - km.map('gh', return5) - km.map('agh', return5) - km.map('a<dir>', add_dirs) - - kb = KeyBuffer(km, directions) - press = self._mkpress(kb, km) - - self.assertEqual(5, press('gh')) - self.assertEqual(5, press('agh')) -# self.assertPressFails(kb, 'agh') - self.assertEqual(1, press('agg')) - - def test_translate_keys(self): def test(string, *args): if not args: @@ -187,7 +162,7 @@ class Test(PressTestCase): self.assertEqual(press('c<CR>'), press('c@')) self.assertEqual(press('c<CR>'), press('c@')) - for n in range(1, 50): + for n in range(1, 10): self.assertPressIncomplete(kb, 'y' * n) for n in range(1, 5): @@ -540,11 +515,13 @@ class Test(PressTestCase): press = self._mkpress(kb) km.map('<dir>', func) + km.map('d<dir>', func) directions.map('j', dir=Direction(down=42)) self.assertEqual(42, press('j')) km.map('o', alias='j') self.assertEqual(42, press('o')) + self.assertEqual(42, press('do')) def test_both_directory_and_any_key(self): def func(arg): @@ -571,4 +548,29 @@ class Test(PressTestCase): km.map('abc<any>', func2) self.assertEqual("yay", press('abcd')) + def test_map_collision(self): + def add_dirs(arg): + return sum(dir.down() for dir in arg.directions) + def return5(_): + return 5 + + + directions = KeyMap() + directions.map('gg', dir=Direction(down=1)) + + + km = KeyMap() + km.map('gh', return5) + km.map('agh', return5) + km.map('a<dir>', add_dirs) + + kb = KeyBuffer(km, directions) + press = self._mkpress(kb, km) + + self.assertEqual(5, press('gh')) + self.assertEqual(5, press('agh')) +# self.assertPressFails(kb, 'agh') + self.assertEqual(1, press('agg')) + + if __name__ == '__main__': main() |