Commits

Peter Hosey  committed 273618d

Test cases for version strings prefixed and suffixed by spaces and line feeds. GVU test coverage now 87.8% (up from 86.3%).

  • Participants
  • Parent commits ec1cf41
  • Branches default

Comments (0)

Files changed (2)

File Unit tests/TestVersionParsing.h

 - (void) testParseWordFollowedByReleaseVersion;
 - (void) testParseReleaseVersionFollowedByWord;
 
+- (void) testParseVersionStringPrefixedBySpaces;
+- (void) testParseVersionStringPrefixedByLineFeed;
+- (void) testParseVersionStringSuffixedBySpaces;
+- (void) testParseVersionStringSuffixedByLineFeed;
+
 @end

File Unit tests/TestVersionParsing.m

 	STAssertFalse(parseVersionString(string, &version), @"Successfully parsed a version followed by a word (%@) - this should have failed. Output version was %@", string, [NSMakeCollectable(createVersionDescription(version)) autorelease]);
 }
 
+- (void) testParseVersionStringPrefixedBySpaces {
+	struct Version version;
+	NSString *string = @"  1.3.2b5";
+	STAssertTrue(parseVersionString(string, &version), @"Could not parse a version string preceded by spaces");
+}
+- (void) testParseVersionStringPrefixedByLineFeed {
+	struct Version version;
+	NSString *string = @"\n1.3.2b5";
+	STAssertTrue(parseVersionString(string, &version), @"Could not parse a version string preceded by a line feed");
+}
+- (void) testParseVersionStringSuffixedBySpaces {
+	struct Version version;
+	NSString *string = @"1.3.2b5  ";
+	STAssertTrue(parseVersionString(string, &version), @"Could not parse a version string followed by spaces");
+}
+- (void) testParseVersionStringSuffixedByLineFeed {
+	struct Version version;
+	NSString *string = @"1.3.2b5\n";
+	STAssertTrue(parseVersionString(string, &version), @"Could not parse a version string followed by a line feed");
+}
+
 @end