Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dasdom/10346561 to your computer and use it in GitHub Desktop.
Save dasdom/10346561 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -w
use strict;
if (not defined($ARGV[1])) {
die "usage: $0 <class name> <file with property names>\n";
}
open(PROP, $ARGV[1]) || die "could not open property names file: $!\n";
my $className = $ARGV[0];
while (defined(my $line = <PROP>)) {
chomp($line);
print "- (void)testThat" . $className . "Has";
print ucfirst($line) . "Property {\n";
print "\tobjc_property_t " . $line . "Property = class_getProperty([";
print $className . " class], \"" . $line . "\");\n";
print "\tXCTAssertTrue(" . $line . "Property != NULL, @\"";
print $className . " should have a " . $line . " property.\");\n}\n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment