Skip to content

Commit

Permalink
reenabled more unit tests for iOS.
Browse files Browse the repository at this point in the history
oddly, test_match.nu is broken in the simulator only.
  • Loading branch information
timburks committed Jun 19, 2011
1 parent 78fc726 commit 9adda50
Show file tree
Hide file tree
Showing 8 changed files with 317 additions and 332 deletions.
Expand Up @@ -25,7 +25,7 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Release">
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
Expand All @@ -34,7 +34,7 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
buildConfiguration = "Debug"
enablesOpenGLESFrameCapture = "YES">
<BuildableProductRunnable>
<BuildableReference
Expand Down
4 changes: 2 additions & 2 deletions MacOS/Nu-framework/NuApp/NuAppDelegate.m
Expand Up @@ -45,8 +45,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

NuInit();

[[Nu sharedParser] parseEval:@"(load \"nu.nu\""];
[[Nu sharedParser] parseEval:@"(load \"test.nu\""];
[[Nu sharedParser] parseEval:@"(load \"nu\")"];
[[Nu sharedParser] parseEval:@"(load \"test\")"];

NSString *resourceDirectory = [[NSBundle mainBundle] resourcePath];

Expand Down
17 changes: 7 additions & 10 deletions test/test_characters.nu
Expand Up @@ -30,23 +30,20 @@
(assert_equal 32 '\s'))

(- (id) testOctalEscapedCharacters is
(if (eq (uname) "Darwin") ;; requires UTF-8
(assert_equal 0 '\000'))
(assert_equal 0 '\000')
(assert_equal 1 '\001')
(assert_equal 255 '\377'))

(- (id) testHexEscapedCharacters is
(if (eq (uname) "Darwin") ;; requires UTF-8
(assert_equal 0 '\x00'))
(assert_equal 0 '\x00')
(assert_equal 1 '\x01')
(assert_equal 255 '\xfF'))

(if (eq (uname) "Darwin") ;; requires UTF-8
(- (id) testUnicodeEscapedCharacters is
(assert_equal 0 '\u0000')
(assert_equal 1 '\u0001')
(assert_equal 65535 '\uFfFf')
(assert_equal 255 '\u00ff')))
(- (id) testUnicodeEscapedCharacters is
(assert_equal 0 '\u0000')
(assert_equal 1 '\u0001')
(assert_equal 65535 '\uFfFf')
(assert_equal 255 '\u00ff'))

(- (id) testFourCharacterIntegers is
(assert_equal 1886604404 'psLt')
Expand Down
74 changes: 35 additions & 39 deletions test/test_exceptions.nu
Expand Up @@ -2,7 +2,7 @@
;; tests for Nu exception handling.
;;
;; Copyright (c) 2007 Tim Burks, Radtastical Inc.
(if (eq (uname) "Darwin")

(class TestExceptions is NuTestCase

(- (id) testRangeException is
Expand Down Expand Up @@ -37,42 +37,38 @@
(assert_equal "UserException" name)
(assert_equal 99 z))

(if (eq (uname) "Darwin")
(- (id) testUserThrownException is
(set name nil)
(set before nil)
(set after nil)
(set z nil)
(try
(set before "this should always be set")
(throw ((NSException alloc) initWithName:"UserException" reason:"" userInfo:nil))
(set after "this should never be set")
(catch (exception) (set name (exception name)))
(finally (set z 99)))
(assert_equal "this should always be set" before)
(assert_equal nil after)
(assert_equal "UserException" name)
(assert_equal 99 z))

(- (id) testUserThrownObject is
(set object nil)
(set before nil)
(set after nil)
(set z nil)
(try
(set before "this should always be set")
(throw 99)
(catch (thrown) (set object thrown))
(finally (set z 99)))
(assert_equal "this should always be set" before)
(assert_equal nil after)
(assert_equal 99 object)
(assert_equal 99 z))

(- (id) testAssertThrown is
(assert_throws "UserException"
(do () (throw ((NSException alloc) initWithName:"UserException" reason:"" userInfo:nil)))))))


(- (id) testUserThrownException is
(set name nil)
(set before nil)
(set after nil)
(set z nil)
(try
(set before "this should always be set")
(throw ((NSException alloc) initWithName:"UserException" reason:"" userInfo:nil))
(set after "this should never be set")
(catch (exception) (set name (exception name)))
(finally (set z 99)))
(assert_equal "this should always be set" before)
(assert_equal nil after)
(assert_equal "UserException" name)
(assert_equal 99 z))

(- (id) testUserThrownObject is
(set object nil)
(set before nil)
(set after nil)
(set z nil)
(try
(set before "this should always be set")
(throw 99)
(catch (thrown) (set object thrown))
(finally (set z 99)))
(assert_equal "this should always be set" before)
(assert_equal nil after)
(assert_equal 99 object)
(assert_equal 99 z))

(- (id) testAssertThrown is
(assert_throws "UserException"
(do () (throw ((NSException alloc) initWithName:"UserException" reason:"" userInfo:nil))))))

)

0 comments on commit 9adda50

Please sign in to comment.