コード例 #1
0
ファイル: test_calls.py プロジェクト: mvcisback/spiderflunky
def test_nested():
    """Assert we identify calls to functions within the calling scope."""
    js = """function call() {
                function answer() {}

                answer();
            }"""
    ast = parse(js)
    g = call_graph(ast)
    eq_(set([(get_name(x), get_name(y)) for x, y in g.edges()]),
        set([('call', 'answer')]))
コード例 #2
0
ファイル: test_calls.py プロジェクト: mvcisback/spiderflunky
def test_nested():
    """Assert we identify calls to functions within the calling scope."""
    js = """function call() {
                function answer() {}

                answer();
            }"""
    ast = parse(js)
    g = call_graph(ast)
    eq_(set([(get_name(x), get_name(y)) for x,y in g.edges()]),
        set([('call', 'answer')]))
コード例 #3
0
ファイル: test_calls.py プロジェクト: mvcisback/spiderflunky
def test_simple():
    """Assert we notice simple calls to functions stored in global scope."""
    js = """function answer() {}

            function call() {
                answer();
            }"""
    ast = parse(js)
    g = call_graph(ast)
    eq_(set([(get_name(x), get_name(y)) for x, y in g.edges()]),
        set([('call', 'answer')]))
コード例 #4
0
ファイル: test_calls.py プロジェクト: mvcisback/spiderflunky
def test_simple():
    """Assert we notice simple calls to functions stored in global scope."""
    js = """function answer() {}

            function call() {
                answer();
            }"""
    ast = parse(js)
    g = call_graph(ast)
    eq_(set([(get_name(x), get_name(y)) for x,y in g.edges()]),
        set([('call', 'answer')]))