Example #1
0
def test_equal():
    parser = JSParser()
    code = b'''var a;
function test()
{
    console.info("test");
}'''
    assert list(helper.splitlines(code)) == list(
        helper.test_parser(parser, code))
Example #2
0
def test_equal():
    parser = PHPParser()
    code = b'''<?php
$a = 0;
print_r($a);
function a($b)
{
    return 0;
}
'''
    assert list(helper.splitlines(code)) == list(
        helper.test_parser(parser, code))
Example #3
0
def test_additional():
    parser = JSParser()
    before = b'''function a() {
    console.info("test");
}'''
    after = b'''function a()
{
    console.info("test");
}
'''
    assert b"".join(helper.splitlines(after)) == b"".join(
        helper.test_parser(parser, before))
Example #4
0
def test_equal():
    parser = PyParser()
    code = b'''print("hoi")
print("hay")
if True:
    print("blu")


def fun():
    print("bla")
'''
    assert list(helper.splitlines(code)) == list(
        helper.test_parser(parser, code))
Example #5
0
def test_addition():
    parser = PHPParser()
    before = b'''<?php
function a($b) {
    return 0;
}'''
    after = b'''<?php
function a($b)
{
    return 0;
}'''
    assert b"".join(helper.splitlines(after)) == b"".join(
        helper.test_parser(parser, before))
Example #6
0
def test_additional():
    parser = PyParser()
    before = b'''def fun1():
    pass
def fun2():
    pass
'''
    after = b'''def fun1():
    pass


def fun2():
    pass
'''
    assert list(helper.splitlines(after)) == list(
        helper.test_parser(parser, before))