Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Commit

Permalink
added test-case for violating the postcondition
Browse files Browse the repository at this point in the history
  • Loading branch information
andresteingress committed May 19, 2011
1 parent 35ff5b5 commit 3d41b81
Showing 1 changed file with 30 additions and 1 deletion.
Expand Up @@ -112,6 +112,35 @@ class Account {
"""

def a = create_instance_of(source)
a.some_method()
assert a.some_method()
}

@Test void multiple_return_statements_with_try_finally_violation() {

def source = """
import org.gcontracts.annotations.*
class Account {
@Ensures({ result != 3 })
def some_method() {
if (true) {
try {
throw new Exception ('test')
return 1
} finally {
return 3
}
}
return 2
}
}
"""

def a = create_instance_of(source)
shouldFail PostconditionViolation, {
a.some_method()
}
}
}

0 comments on commit 3d41b81

Please sign in to comment.