Skip to content

Commit

Permalink
Add test case for invalid bundle.json in nested dir (valid one in par…
Browse files Browse the repository at this point in the history
…ent)

This is in anticipation of what's going to change in ponylang#68.

Signed-off-by: Stephan Renatus <[email protected]>
  • Loading branch information
srenatus committed Jun 19, 2018
1 parent 21c1c34 commit cbab081
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions stable/test/integration/test_env.pony
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ actor EnvTests is TestList
test(TestEnvBundleInSameDir)
test(TestEnvBundleInSameDirWithCall)
test(TestEnvBundleInParentDir)
test(TestEnvBadBundleInNestedAndValidBundleInParentDir)

class TestEnvNoBundle is UnitTest
new iso create() => None
Expand Down Expand Up @@ -177,3 +178,40 @@ class TestEnvBundleInParentDir is UnitTest
None,
0)
_Exec(h, "stable env", nested.path, _CleanTmp(tmp), consume notifier)

class TestEnvBadBundleInNestedAndValidBundleInParentDir is UnitTest
new iso create() => None

fun name(): String => "integration.Env(invalid bundle.json in nested dir)"

fun apply(h: TestHelper) =>
h.long_test(100_000_000)
let tmp =
try
FilePath.mkdtemp(h.env.root as AmbientAuth, "")?
else
h.fail("failed to create temporary directory")
return
end

(let bad_bundle, let good_bundle, let nested) =
try
h.assert_true(Directory(tmp)?.mkdir("nested"), "create nested directory")
let n = tmp.join("nested")?
(Directory(n)?.create_file("bundle.json")?,
Directory(tmp)?.create_file("bundle.json")?,
n)
else
h.fail("failed to create bundle.json example data files")
return
end
h.assert_true(good_bundle.write("{\"deps\":[
{\"type\": \"local\", \"local-path\":\"../local/a\"}
]}\n"), "prepare good bundle.json")
h.assert_true(bad_bundle.write("{}"), "prepare bad bundle.json")

let notifier: ProcessNotify iso = _ExpectClient(h,
["PONYPATH=../local/a"],
None,
0)
_Exec(h, "stable env", nested.path, _CleanTmp(tmp), consume notifier)

0 comments on commit cbab081

Please sign in to comment.