Exemplo n.º 1
0
def test_skip_initarg():
    tests = ['a b c', '"a better test" b c', '" a better test" b c']
    for t in tests:
        # Some memory management issues here.
        #   skip_initarg returns a pointer into the original string
        #   so we need to keep that string, and that means
        #   explicitly allocating it with ffi.new
        x = ffi.new('wchar_t[]', t)
        assert ffi.string(lib.skip_initarg(x)) == 'b c'
Exemplo n.º 2
0
def test_skip_initarg():
    tests = [
        'a b c',
        '"a better test" b c',
        '" a better test" b c'
            ]
    for t in tests:
        # Some memory management issues here.
        #   skip_initarg returns a pointer into the original string
        #   so we need to keep that string, and that means
        #   explicitly allocating it with ffi.new
        x = ffi.new('wchar_t[]', t)
        assert ffi.string(lib.skip_initarg(x)) == 'b c'
Exemplo n.º 3
0
def test_find_on_path():
    sysexe = ffi.string(lib.find_on_path("python"))
    assert sysexe == os.path.dirname(sys.executable)
Exemplo n.º 4
0
def test_find_on_path():
    sysexe = ffi.string(lib.find_on_path("python"))
    assert sysexe == os.path.dirname(sys.executable)