|
| 1 | +import utest.Assert; |
| 2 | + |
| 3 | +class TestRun extends buddy.BuddySuite { |
| 4 | + public function new() { |
| 5 | + super(); |
| 6 | + describe("haxelib run hxmustache", function() { |
| 7 | + it("should render using given arguments", function() { |
| 8 | + var args = [ |
| 9 | + "run", |
| 10 | + "hxmustache", |
| 11 | + "test/test_view.json", |
| 12 | + "test/test_template.mustache", |
| 13 | + "-p", "test/test_layout.mustache" |
| 14 | + ]; |
| 15 | + var proc = new sys.io.Process("haxelib", args); |
| 16 | + var exitCode = proc.exitCode(); |
| 17 | + var stdout = StringTools.replace(proc.stdout.readAll().toString(), "\r\n", "\n"); |
| 18 | + var expected = sys.io.File.getContent("test/test_expected.html"); |
| 19 | + Assert.equals(0, exitCode); |
| 20 | + Assert.equals(expected, stdout); |
| 21 | + }); |
| 22 | + it("should render to file using given arguments", function() { |
| 23 | + var args = [ |
| 24 | + "run", |
| 25 | + "hxmustache", |
| 26 | + "test/test_view.json", |
| 27 | + "test/test_template.mustache", |
| 28 | + "-p", "test/test_layout.mustache", |
| 29 | + "test/test_output.html" |
| 30 | + ]; |
| 31 | + var proc = new sys.io.Process("haxelib", args); |
| 32 | + var exitCode = proc.exitCode(); |
| 33 | + var stdout = StringTools.replace(proc.stdout.readAll().toString(), "\r\n", "\n"); |
| 34 | + var expected = sys.io.File.getContent("test/test_expected.html"); |
| 35 | + var actual = sys.io.File.getContent("test/test_output.html"); |
| 36 | + Assert.equals(0, exitCode); |
| 37 | + Assert.equals(expected, actual); |
| 38 | + Assert.equals("", stdout); |
| 39 | + }); |
| 40 | + }); |
| 41 | + } |
| 42 | +} |
0 commit comments