Skip to content

Commit

Permalink
update test example
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidesu committed Oct 27, 2023
1 parent 5094147 commit dbf344e
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions examples/test.ghost
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
function expect(value) {
return {
toBe: function(expected) {
if (value != expected) {
// console.log("Expected failed")
return false
} else {
// console.log("Passed")
return true
}
}
}
}

function test(description, callback) {
result = callback()

if (!result) {
ghost.abort(description + " ...FAILED")
console.log(description + " ...FAILED")
return
}

console.log(description + " ...PASSED")
}

test("example test A", function() {
print(a == 1)
return a == 1
return expect(1).toBe(2)
})

// test("example test B", function() {
// return 1 == 2
// })
test("example test B", function() {
return expect(1).toBe(1)
})

0 comments on commit dbf344e

Please sign in to comment.