Skip to content

Instantly share code, notes, and snippets.

@itfrombit
Created October 28, 2010 03:13
Show Gist options
  • Save itfrombit/650544 to your computer and use it in GitHub Desktop.
Save itfrombit/650544 to your computer and use it in GitHub Desktop.
Detecting when nush is accidentally run instead of nutest on a NuTestCase
diff --git a/objc/nu.m b/objc/nu.m
index 1d21a56..170206c 100644
--- a/objc/nu.m
+++ b/objc/nu.m
@@ -230,6 +230,12 @@ int NuMain(int argc, const char *argv[], const char *envp[])
@catch (NuException* nuException)
{
printf("%s\n", [[nuException dump] cStringUsingEncoding:NSUTF8StringEncoding]);
+ if ([[nuException name] isEqualToString:@"NuUndefinedSuperclass"]) {
+ NSArray* a = [[nuException reason] componentsSeparatedByString:@" "];
+ if (([a count] == 3) && ([[a objectAtIndex:2] isEqualToString:@"NuTestCase"])) {
+ printf("Did you mean to use nutest instead of nush?\n");
+ }
+ }
}
@catch (id exception)
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment