Esempio n. 1
0
    def test_callsite_multiple_returns(self):
        results = sorted(
            list(map(lambda r: r[0], find("multiple_returns", True))))

        expected = sorted(
            ['r1, r2, r3, r4 = multiple_returns(cbuffer, index)'])
        self.assertEqual(expected, results)
Esempio n. 2
0
    def test_methods(self):
        results = sorted(list(map(lambda r: r[0], find("bar"))))

        expected = sorted([
            'Foo.bar(x, y)', 'baz,boz = Foo.bar(x, y)',
            'baz,boz = foobar(x, y)', 'function bar1(param1, param2)',
            'function tbl.bar()'
        ])

        self.assertEqual(expected, results)
Esempio n. 3
0
    def test_callsite_returns_exact_matches(self):
        results = sorted(list(map(lambda r: r[0], find("baz", True))))

        expected = sorted(['function baz()'])
        self.assertEqual(expected, results)
Esempio n. 4
0
    def test_descriptions_are_not_matched(self):
        results = sorted(list(map(lambda r: r[0], find("blabla"))))

        self.assertEqual([], results)
Esempio n. 5
0
    def test_case_difference(self):
        results = sorted(list(map(lambda r: r[0], find("Foo"))))

        self.assertEqual([], results)
Esempio n. 6
0
    def test_leading_wildcard(self):
        results = sorted(list(map(lambda r: r[0], find("*o1"))))

        expected = sorted(['foo1(x)', 'function foo1(param1, param2, ...)'])
        self.assertEqual(expected, results)
Esempio n. 7
0
    def test_variadic_return(self):
        results = sorted(list(map(lambda r: r[0], find("variadic_return"))))

        expected = sorted(['a1,... = variadic_return(x, y)'])
        self.assertEqual(expected, results)
Esempio n. 8
0
    def test_basic_pattern(self):
        results = sorted(list(map(lambda r: r[0], find("foo1"))))

        expected = sorted(['foo1(x)', 'function foo1(param1, param2, ...)'])
        self.assertEqual(expected, results)