LEFT | RIGHT |
(no file at all) | |
1 # This Source Code Form is subject to the terms of the Mozilla Public | 1 # This Source Code Form is subject to the terms of the Mozilla Public |
2 # License, v. 2.0. If a copy of the MPL was not distributed with this | 2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
4 | 4 |
5 import difflib | 5 import difflib |
6 import json | 6 import json |
7 import os | 7 import os |
8 import re | 8 import re |
9 import shutil | 9 import shutil |
10 import zipfile | 10 import zipfile |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 @pytest.fixture | 228 @pytest.fixture |
229 def lib_files(tmpdir): | 229 def lib_files(tmpdir): |
230 files = packager.Files(['lib'], set()) | 230 files = packager.Files(['lib'], set()) |
231 files['ext/a.js'] = 'require("./c.js");\nrequire("info");\nvar bar;' | 231 files['ext/a.js'] = 'require("./c.js");\nrequire("info");\nvar bar;' |
232 files['lib/b.js'] = 'var foo;' | 232 files['lib/b.js'] = 'var foo;' |
233 files['lib/aliased.js'] = 'require("mogo");' | 233 files['lib/aliased.js'] = 'require("mogo");' |
234 files['lib/mogo.js'] = 'var this_is_mogo;' | 234 files['lib/mogo.js'] = 'var this_is_mogo;' |
235 files['lib/edge.js'] = 'var this_is_edge;' | 235 files['lib/edge.js'] = 'var this_is_edge;' |
236 files['ext/c.js'] = 'var this_is_c;' | 236 files['ext/c.js'] = 'var this_is_c;' |
237 files['ext/alias_c.js'] = 'var this_is_aliased_c;' | 237 files['ext/alias_c.js'] = 'var this_is_aliased_c;' |
238 files['qunit/common.js'] = 'var qunit = {};' | |
239 files['qunit/tests/some_test.js'] = 'var passed = true;' | 238 files['qunit/tests/some_test.js'] = 'var passed = true;' |
240 | 239 |
241 libdir = tmpdir.mkdir('lib') | 240 libdir = tmpdir.mkdir('lib') |
242 libdir.join('b.js').write(files['lib/b.js']) | 241 libdir.join('b.js').write(files['lib/b.js']) |
243 libdir.join('aliased.js').write(files['lib/aliased.js']) | 242 libdir.join('aliased.js').write(files['lib/aliased.js']) |
244 libdir.join('mogo.js').write(files['lib/mogo.js']) | 243 libdir.join('mogo.js').write(files['lib/mogo.js']) |
245 libdir.join('edge.js').write(files['lib/edge.js']) | 244 libdir.join('edge.js').write(files['lib/edge.js']) |
246 ext_dir = tmpdir.mkdir('ext') | 245 ext_dir = tmpdir.mkdir('ext') |
247 ext_dir.join('a.js').write(files['ext/a.js']) | 246 ext_dir.join('a.js').write(files['ext/a.js']) |
248 ext_dir.join('c.js').write(files['ext/c.js']) | 247 ext_dir.join('c.js').write(files['ext/c.js']) |
249 qunit_dir = tmpdir.mkdir('qunit') | 248 qunit_dir = tmpdir.mkdir('qunit') |
250 qunit_dir.join('common.js').write(files['qunit/common.js']) | |
251 qunit_tests_dir = qunit_dir.mkdir('tests') | 249 qunit_tests_dir = qunit_dir.mkdir('tests') |
252 qunit_tests_dir.join('some_test.js').write( | 250 qunit_tests_dir.join('some_test.js').write( |
253 files['qunit/tests/some_test.js'], | 251 files['qunit/tests/some_test.js'], |
254 ) | 252 ) |
255 return files | 253 return files |
256 | 254 |
257 | 255 |
258 def comparable_json(json_data): | 256 def comparable_json(json_data): |
259 """Create a nonambiguous representation of the given JSON data.""" | 257 """Create a nonambiguous representation of the given JSON data.""" |
260 if isinstance(json_data, basestring): | 258 if isinstance(json_data, basestring): |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 expected = os.path.join( | 493 expected = os.path.join( |
496 os.path.dirname(__file__), | 494 os.path.dirname(__file__), |
497 'expecteddata', | 495 'expecteddata', |
498 filename.format(name, ext), | 496 filename.format(name, ext), |
499 ) | 497 ) |
500 | 498 |
501 assert_manifest_content( | 499 assert_manifest_content( |
502 package.read(os.path.join(folder, '{}.{}'.format(name, ext))), | 500 package.read(os.path.join(folder, '{}.{}'.format(name, ext))), |
503 expected, | 501 expected, |
504 ) | 502 ) |
LEFT | RIGHT |