Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Made nest if statement test more comprehensive
  • Loading branch information
Kartik Thakore committed Feb 13, 2013
1 parent 211e351 commit 13eb82c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/test/scala/org/moe/parser/BooleanLiteralTestSuite.scala
Expand Up @@ -19,6 +19,9 @@ class BooleanLiteralTestSuite extends FunSuite with BeforeAndAfter with ParserTe
val result = interpretCode("false")
assert(result.asInstanceOf[MoeBooleanObject].getNativeValue === false)
}

test("... basic test with a not true") {
val result = interpretCode(" false ")
assert(result.asInstanceOf[MoeBooleanObject].getNativeValue === false)
}

}
15 changes: 15 additions & 0 deletions src/test/scala/org/moe/parser/IfStatementTestSuite.scala
Expand Up @@ -25,4 +25,19 @@ class IfStatementTestSuite extends FunSuite with BeforeAndAfter with ParserTestU
assert(result.asInstanceOf[MoeIntObject].getNativeValue === 200)
}

test("... nested if true in if false ") {
val result = interpretCode("if (false) { if ( true ) { 200 } }")
assert(result.asInstanceOf[MoeUndefObject] === runtime.NativeObjects.getUndef)
}

test("... nested if false in if true") {
val result = interpretCode("if (true) { if ( false ) { 200 } }")
assert(result.asInstanceOf[MoeUndefObject] === runtime.NativeObjects.getUndef)
}

/bin/bash: :w: command not found
val result = interpretCode("if (false) { if ( true ) { 200 } }")
assert(result.asInstanceOf[MoeUndefObject] === runtime.NativeObjects.getUndef)
}

}

0 comments on commit 13eb82c

Please sign in to comment.