Last active
August 29, 2015 14:16
-
-
Save bassosimone/231f43eb8285303c2007 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface GenericTest : NSObject | |
typedef void(^begin_function)(void); | |
typedef void(^end_function)(void); | |
+ (GenericTest *)make_test:NSDictionary; | |
- (void)begin:begin_function; | |
- (void)end:end_function; | |
/// | |
@interface ight : NSObject | |
+ (void)loop; | |
+ (void)break_loop; | |
// FIXME: What is missing is a way to know the progress status | |
// Maybe we can add a callback called progress? | |
/// | |
NSDictionary *settings = @{ | |
@"nameserver": @"8.8.8.8", | |
@"input_filepath": @"/foo/bar", | |
@"test_name": @"ooni/dns_injection", | |
}; | |
GenericTest *test = [GenericTest make_test:settings]; | |
// What I wonder is how much this syntax is surprising (or commonly used!) in ObjeC | |
[test begin ^{} { | |
[test end ^{} { | |
[ight break_loop]; | |
] | |
]; | |
[ight loop]; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment