Skip to content

Commit

Permalink
Make the current code work on iOS again.
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy committed Jan 7, 2011
1 parent 3174cfa commit 5eae556
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
15 changes: 12 additions & 3 deletions bacon.nu
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
)

(- addContext:(id)context is
(@contexts << context)
(@contexts addObject:context)
)

(- (id) run is
Expand All @@ -29,7 +29,11 @@
; TODO make this work nicely when there is already a runloop, like in an (iOS) app runner
;((NSRunLoop mainRunLoop) runUntilDate:(NSDate dateWithTimeIntervalSinceNow:0.1))
;((NSRunLoop mainRunLoop) runUntilDate:(NSDate distantFuture))
((NSApplication sharedApplication) run)
(try
((NSApplication sharedApplication) run)
(catch (e))
; running on iOS most probably
)
)

(- (id) currentContext is
Expand All @@ -45,7 +49,11 @@
(else
; DONE!
($BaconSummary print)
((NSApplication sharedApplication) terminate:self)
(try
((NSApplication sharedApplication) terminate:self)
(catch (e))
; running on iOS most probably
)
)
)
)
Expand Down Expand Up @@ -75,3 +83,4 @@
(- (id) should is ((BaconShould alloc) initWithObject:self))
(- (id) should:(id)block is (((BaconShould alloc) initWithObject:self) satisfy:nil block:block))
)

6 changes: 3 additions & 3 deletions bacon_context.nu
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@
)

(- (id) before:(id)block is
(@_before << block)
(@_before addObject:block)
)

(- (id) after:(id)block is
(@_after << block)
(@_after addObject:block)
)

(- (id) addSpecification:(id)description withBlock:(id)block report:(id)report is
(set specification ((BaconSpecification alloc) initWithContext:self description:description block:block before:@_before after:@_after report:report))
(@_specifications << specification)
(@_specifications addObject:specification)
)
)
2 changes: 1 addition & 1 deletion bacon_macros.nu
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
)
(else
; this is a selector without args, so remove it from the messages list and continue
(__messagesWithoutArgs << __message)
(__messagesWithoutArgs addObject:__message)
(set __messages (cdr __messages))
)
)
Expand Down
4 changes: 2 additions & 2 deletions bacon_specification.nu
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
)

(- (id) runBeforeFilters is
(@before each:(do (x) (@context instanceEval:x)))
((@before list) each:(do (x) (@context instanceEval:x)))
)

(- (id) runAfterFilters is
(@after each:(do (x) (@context instanceEval:x)))
((@after list) each:(do (x) (@context instanceEval:x)))
)

(- (id) run is
Expand Down

0 comments on commit 5eae556

Please sign in to comment.