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.py54
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()
1-06-26 20:55:36 -0700 committer Kartik Agaram <vc@akkartik.com> 2021-06-26 20:55:36 -0700 html: better highlighting for int registers' href='/akkartik/mu/commit/html/linux/401test.mu.html?h=main&id=372367f59a897162912d0646158bdea1e07d6e66'>372367f5 ^
9cbd4199 ^
































3350c34a ^
9cbd4199 ^
d3a9db3a ^
9cbd4199 ^
3350c34a ^
372367f5 ^
7fa80570 ^


3350c34a ^
372367f5 ^
7fa80570 ^

9cbd4199 ^



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