From 835840e8daa740c895b09491e4c07de32657b8c8 Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Mon, 13 Dec 2010 01:27:22 -0500 Subject: [PATCH] minor enhancements to test/exception_handling.coffee --- test/exception_handling.coffee | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/test/exception_handling.coffee b/test/exception_handling.coffee index 0d297db3..5c895f9d 100644 --- a/test/exception_handling.coffee +++ b/test/exception_handling.coffee @@ -4,11 +4,13 @@ # shared nonce nonce = {} + #### Throw test "basic exception throwing", -> throws (-> throw 'error'), 'error' + #### Empty Try/Catch/Finally test "try can exist alone", -> @@ -57,20 +59,25 @@ test "single-line result of try when no exception is thrown", -> eq nonce, result test "return the result of catch when an exception is thrown", -> - result = try - throw -> - catch err - nonce - eq nonce, result + fn = -> + try + throw -> + catch err + nonce + doesNotThrow fn + eq nonce, fn() test "single-line result of catch when an exception is thrown", -> - result = try throw -> catch err then nonce - eq nonce, result + fn = -> + try throw (->) catch err then nonce + doesNotThrow fn + eq nonce, fn() test "optional catch", -> fn = -> try throw -> nonce + doesNotThrow fn eq nonce, fn()