Skip to content

Commit

Permalink
feat(tryCatch): add an example and 2 tests for tryCatch
Browse files Browse the repository at this point in the history
  • Loading branch information
niieani committed Jul 8, 2018
1 parent e239aee commit 84c4511
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions example/trycatch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

source "$( cd "${BASH_SOURCE[0]%/*}" && pwd )/../lib/oo-bootstrap.sh"

import util/exception util/tryCatch util/log util/test

describe 'Try Catch'
it 'should throw a "test exception"'
try
try {
e="test exception" throw
} catch {
[[ "${__EXCEPTION__[1]}" == "test exception" ]]
}
expectPass

it 'should throw a general exception inside of a catch'
try {
try {
false
} catch {
e="we throw again inside of a catch" throw
echo this should not be displayed
}
echo this should not be displayed
}
expectFail

summary

0 comments on commit 84c4511

Please sign in to comment.