예제 #1
0
class Test_Mapping_Expanding(BufferTest):
    def setUp(self):
        super().setUp()
        self.state = state.State(self.view)
        self.mappings = Mappings(self.state)
        self.mappings.clear()

    def testCanExpand(self):
        for (i, data) in enumerate(expanding_tests):
            setup_data, test_data = data

            mode, keys, new_mapping = setup_data
            self.mappings.add(mode, keys, new_mapping)

            self.state.mode = modes.NORMAL

            seq, expected_head, expected_mapping, expected_tail, expected_full, expected_status = test_data
            result = self.mappings.expand_first(seq)

            self.assertEqual(result.head, expected_head,
                             '[{0}] head failed'.format(i))
            self.assertEqual(result.tail, expected_tail,
                             '[{0}] tail failed'.format(i))
            self.assertEqual(result.mapping, expected_mapping,
                             '[{0}] mapping failed'.format(i))
            self.assertEqual(result.sequence, expected_full,
                             '[{0}] sequence failed'.format(i))
            self.assertEqual(result.status, expected_status,
                             '[{0}] status failed'.format(i))

            self.mappings.clear()
예제 #2
0
class Test_Mappings_AddingAndRemoving(BufferTest):
    def setUp(self):
        super().setUp()
        self.state = state.State(self.view)
        self.mappings = Mappings(self.state)
        self.mappings.clear()

    def testCanAdd(self):
        for (i, data) in enumerate(adding_tests):
            mode, keys, target, msg = data
            self.mappings.add(mode, keys, target)
            self.assertEqual(_mappings[mode][keys], {
                'name': target,
                'type': cmd_types.USER
            }, '{0} [{1}] failed'.format(msg, i))
            self.mappings.clear()

    def testCanRemove(self):
        for (i, data) in enumerate(adding_tests):
            mode, keys, target, msg = data
            self.mappings.add(mode, keys, target)
            self.mappings.remove(mode, keys)

        self.assertFalse(_mappings[modes.NORMAL])
        self.assertFalse(_mappings[modes.VISUAL])
        self.assertFalse(_mappings[modes.VISUAL_LINE])
        self.assertFalse(_mappings[modes.VISUAL_BLOCK])
예제 #3
0
class Test_Mapping_Expanding(BufferTest):
    def setUp(self):
        super().setUp()
        self.state = state.State(self.view)
        self.mappings = Mappings(self.state)
        self.mappings.clear()

    def testCanExpand(self):
        for (i, data) in enumerate(expanding_tests):
            setup_data, test_data = data

            mode, keys, new_mapping = setup_data
            self.mappings.add(mode, keys, new_mapping)

            self.state.mode = modes.NORMAL

            seq, expected_head, expected_mapping, expected_tail, expected_full, expected_status = test_data
            result = self.mappings.expand_first(seq)

            self.assertEqual(result.head, expected_head, '[{0}] head failed'.format(i))
            self.assertEqual(result.tail, expected_tail, '[{0}] tail failed'.format(i))
            self.assertEqual(result.mapping, expected_mapping, '[{0}] mapping failed'.format(i))
            self.assertEqual(result.sequence, expected_full, '[{0}] sequence failed'.format(i))
            self.assertEqual(result.status, expected_status, '[{0}] status failed'.format(i))

            self.mappings.clear()
예제 #4
0
class Test_Mappings_AddingAndRemoving(BufferTest):
    def setUp(self):
        super().setUp()
        self.state = state.State(self.view)
        self.mappings = Mappings(self.state)
        self.mappings.clear()

    def testCanAdd(self):
        for (i, data) in enumerate(adding_tests):
            mode, keys, target, msg = data
            self.mappings.add(mode, keys, target)
            self.assertEqual(_mappings[mode][keys], {'name': target, 'type': cmd_types.USER}, '{0} [{1}] failed'.format(msg, i))
            self.mappings.clear()
예제 #5
0
class Test_Mappings_AddingAndRemoving(BufferTest):
    def setUp(self):
        super().setUp()
        self.state = state.State(self.view)
        self.mappings = Mappings(self.state)
        self.mappings.clear()

    def testCanAdd(self):
        for (i, data) in enumerate(adding_tests):
            mode, keys, target = data
            self.mappings.add(mode, keys, target)
            self.assertEqual(_mappings[mode][keys], target, '[{0}] failed')
            self.mappings.clear()
예제 #6
0
class Test_Mappings_AddingAndRemoving(ViewTest):
    def setUp(self):
        super().setUp()
        self.mappings = Mappings(self.state)
        self.mappings.clear()

    def testCanAdd(self):
        for (i, data) in enumerate(adding_tests):
            mode, keys, target, msg = data
            self.mappings.add(mode, keys, target)
            self.assertEqual(_mappings[mode][keys], {'name': target, 'type': cmd_types.USER}, '{0} [{1}] failed'.format(msg, i))
            self.mappings.clear()

    def testCanRemove(self):
        for (i, data) in enumerate(adding_tests):
            mode, keys, target, msg = data
            self.mappings.add(mode, keys, target)
            self.mappings.remove(mode, keys)

        self.assertFalse(_mappings[modes.NORMAL])
        self.assertFalse(_mappings[modes.VISUAL])
        self.assertFalse(_mappings[modes.VISUAL_LINE])
        self.assertFalse(_mappings[modes.VISUAL_BLOCK])