Beispiel #1
0
def lib_files(tmpdir):
    files = packager.Files(['lib'], set())
    files['ext/a.js'] = 'require("./c.js");\nrequire("info");\nvar bar;'
    files['lib/b.js'] = 'var foo;'
    files['lib/aliased.js'] = 'require("mogo");'
    files['lib/mogo.js'] = 'var this_is_mogo;'
    files['lib/edge.js'] = 'var this_is_edge;'
    files['ext/c.js'] = 'var this_is_c;'
    files['ext/alias_c.js'] = 'var this_is_aliased_c;'
    files['qunit/tests/some_test.js'] = 'var passed = true;'

    libdir = tmpdir.mkdir('lib')
    libdir.join('b.js').write(files['lib/b.js'])
    libdir.join('aliased.js').write(files['lib/aliased.js'])
    libdir.join('mogo.js').write(files['lib/mogo.js'])
    libdir.join('edge.js').write(files['lib/edge.js'])
    ext_dir = tmpdir.mkdir('ext')
    ext_dir.join('a.js').write(files['ext/a.js'])
    ext_dir.join('c.js').write(files['ext/c.js'])
    qunit_dir = tmpdir.mkdir('qunit')
    qunit_tests_dir = qunit_dir.mkdir('tests')
    qunit_tests_dir.join('some_test.js').write(
        files['qunit/tests/some_test.js'],
    )
    return files
Beispiel #2
0
def files():
    """Minimal Files() for testing blockmap."""
    str500 = b''.join(chr(i % 200 + 30) for i in range(500))
    files = packager.Files(set(), set())
    files['Extension/foo.xml'] = str500
    files['Extension/bar.png'] = str500 * 200
    return files
def files():
    """Minimal Files() for testing manifest and blockmap."""
    files = packager.Files(set(), set())
    for size in ['44', '50', '150']:
        files['Assets/logo_{}.png'.format(size)] = CHARS
    files['Extension/_locales/en_US/messages.json'] = MESSAGES_EN_US
    files['Extension/foo.xml'] = CHARS
    files['Extension/bar.png'] = CHARS * 200
    return files
def test_move_files_to_extension():
    files = packager.Files(set(), set())
    files['foo.xml'] = CHARS
    files['foo/bar.xml'] = CHARS
    files['Extension/foo.xml'] = CHARS
    packagerEdge.move_files_to_extension(files)
    assert set(files.keys()) == {
        'Extension/foo.xml', 'Extension/foo/bar.xml',
        'Extension/Extension/foo.xml'
    }