2019-01-15 12:19:58 -05:00
|
|
|
#!/usr/bin/env python
|
2019-01-21 14:03:30 -05:00
|
|
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2019-01-15 12:19:58 -05:00
|
|
|
import os
|
|
|
|
import sys
|
2019-02-01 18:29:00 -05:00
|
|
|
from util import mkdtemp, tests_path, run_output, green_ok
|
2019-01-15 12:19:58 -05:00
|
|
|
import shutil
|
|
|
|
|
|
|
|
|
|
|
|
def prefetch_test(deno_exe):
|
|
|
|
sys.stdout.write("prefetch_test...")
|
|
|
|
sys.stdout.flush()
|
|
|
|
|
2019-02-01 18:29:00 -05:00
|
|
|
deno_dir = mkdtemp()
|
2019-01-15 12:19:58 -05:00
|
|
|
try:
|
|
|
|
t = os.path.join(tests_path, "006_url_imports.ts")
|
2019-04-21 11:34:18 -04:00
|
|
|
output = run_output([deno_exe, "prefetch", t],
|
2019-01-15 12:19:58 -05:00
|
|
|
merge_env={"DENO_DIR": deno_dir})
|
|
|
|
assert output == ""
|
|
|
|
# Check that we actually did the prefetch.
|
|
|
|
os.path.exists(
|
|
|
|
os.path.join(deno_dir,
|
|
|
|
"deps/http/localhost_PORT4545/tests/subdir/mod2.ts"))
|
|
|
|
finally:
|
|
|
|
shutil.rmtree(deno_dir)
|
|
|
|
|
|
|
|
print green_ok()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
prefetch_test(sys.argv[1])
|