summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/tc_newkeys.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/test/tc_newkeys.py b/test/tc_newkeys.py
index 06345450..9bfb43b0 100644
--- a/test/tc_newkeys.py
+++ b/test/tc_newkeys.py
@@ -23,12 +23,21 @@ from ranger.ext.keybinding_parser import parse_keybinding
 
 import sys
 
+def simulate_press(self, string):
+	for char in parse_keybinding(string):
+		self.add(char)
+		if self.done:
+			return self.command
+		if self.failure:
+			break
+	return self.command
+
 class PressTestCase(TestCase):
 	"""Some useful methods for the actual test"""
 	def _mkpress(self, keybuffer, _=0):
 		def press(keys):
 			keybuffer.clear()
-			match = keybuffer.simulate_press(keys)
+			match = simulate_press(keybuffer, keys)
 			self.assertFalse(keybuffer.failure,
 					"parsing keys '"+keys+"' did fail!")
 			self.assertTrue(keybuffer.done,
@@ -41,13 +50,13 @@ class PressTestCase(TestCase):
 
 	def assertPressFails(self, kb, keys):
 		kb.clear()
-		kb.simulate_press(keys)
+		simulate_press(kb, keys)
 		self.assertTrue(kb.failure, "Keypress did not fail as expected")
 		kb.clear()
 
 	def assertPressIncomplete(self, kb, keys):
 		kb.clear()
-		kb.simulate_press(keys)
+		simulate_press(kb, keys)
 		self.assertFalse(kb.failure, "Keypress failed, expected incomplete")
 		self.assertFalse(kb.done, "Keypress done which was unexpected")
 		kb.clear()
@@ -78,7 +87,7 @@ class Test(PressTestCase):
 		self.assertEqual(2, press('ppj'))
 
 		kb.clear()
-		match = kb.simulate_press('pp')
+		match = simulate_press(kb, 'pp')
 		args = CommandArgs(0, 0, kb)
 		self.assert_(match)
 		self.assert_(match.function)
@@ -414,7 +423,7 @@ class Test(PressTestCase):
 		self.assertPressIncomplete(kb, 'xx')
 		self.assertPressIncomplete(kb, 'x')
 		if not sys.flags.optimize:
-			self.assertRaises(AssertionError, kb.simulate_press, 'xxx')
+			self.assertRaises(AssertionError, simulate_press, kb, 'xxx')
 		kb.clear()
 
 	def test_directions_as_functions(self):
mp;id=4ea0f69aed8d4c173d9abbd0a1bd76d6afe69ccb'>^
29028631 ^
f8f6f7f9 ^









f8f6f7f9 ^










1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80