예제 #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)
예제 #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)
예제 #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)
예제 #4
0
    def test_descriptions_are_not_matched(self):
        results = sorted(list(map(lambda r: r[0], find("blabla"))))

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

        self.assertEqual([], results)
예제 #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)
예제 #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)
예제 #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)