<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -267,9 +267,11 @@ const NSInteger jsonDoNotIndent = -1;
 - (BOOL)scanJSONNumber:(NSNumber **)number
 {
 	NSDecimal decimal;
-	BOOL result = [self scanDecimal:&amp;decimal];
-	*number = [NSDecimalNumber decimalNumberWithDecimal:decimal];
-	return result;
+	BOOL isDecimal = [self scanDecimal:&amp;decimal];
+	if ( isDecimal ) {
+		*number = [NSDecimalNumber decimalNumberWithDecimal:decimal];
+	}
+	return isDecimal;
 }
 
 - (BOOL)scanJSONWhiteSpace</diff>
      <filename>NSScanner+BSJSONAdditions.m</filename>
    </modified>
    <modified>
      <diff>@@ -85,6 +85,14 @@ inline BOOL ScanArray(NSString *inString, id *outResult)
 	STAssertEqualObjects(theObject, [NSNull null], @&quot;Result of scan didn't match expectations.&quot;);
 }
 
+- (void) testInvalidNumber;
+{	
+	id number = nil;
+	BOOL isDecimal = [[NSScanner scannerWithString:@&quot;abc&quot;] scanJSONNumber:&amp;number];
+	STAssertFalse( isDecimal, @&quot;postcondition violated&quot; );
+	STAssertNil( number, @&quot;postcondition violated&quot; );
+}
+
 - (void)testNumber
 {
 	id theObject = nil;</diff>
      <filename>Unit Tests/BSJSONScanner_UnitTests.m</filename>
    </modified>
    <modified>
      <diff>@@ -16,7 +16,7 @@
 - (void)testValidJSON
 {
 	// test 'json_test_valid_01.txt&quot;
-	NSString *testFilePath = [[NSBundle mainBundle] pathForResource:@&quot;json_test_valid_01&quot; ofType:@&quot;txt&quot;];
+	NSString *testFilePath = [[NSBundle bundleForClass:[self class]] pathForResource:@&quot;json_test_valid_01&quot; ofType:@&quot;txt&quot;];
 	STAssertNotNil(testFilePath, @&quot;Could not find the test file named \&quot;json_test_valid_01.txt\&quot;&quot;);
 	NSString *jsonString = [NSString stringWithContentsOfFile:testFilePath];
 	STAssertNotNil(jsonString, @&quot;Could not create an NSString from the file at path %@&quot;, testFilePath);
@@ -38,7 +38,7 @@
 	
 	
 	// test 'json_test_valid_02.txt&quot;
-	testFilePath = [[NSBundle mainBundle] pathForResource:@&quot;json_test_valid_02&quot; ofType:@&quot;txt&quot;];
+	testFilePath = [[NSBundle bundleForClass:[self class]] pathForResource:@&quot;json_test_valid_02&quot; ofType:@&quot;txt&quot;];
 	STAssertNotNil(testFilePath, @&quot;Could not find the test file named \&quot;json_test_valid_02.txt\&quot;&quot;);
 	jsonString = [NSString stringWithContentsOfFile:testFilePath];
 	STAssertNotNil(jsonString, @&quot;Could not create an NSString from the file at path %@&quot;, testFilePath);
@@ -57,7 +57,7 @@
 	
 	
 	// test 'json_test_valid_03.txt&quot;
-	testFilePath = [[NSBundle mainBundle] pathForResource:@&quot;json_test_valid_03&quot; ofType:@&quot;txt&quot;];
+	testFilePath = [[NSBundle bundleForClass:[self class]] pathForResource:@&quot;json_test_valid_03&quot; ofType:@&quot;txt&quot;];
 	STAssertNotNil(testFilePath, @&quot;Could not find the test file named \&quot;json_test_valid_03.txt\&quot;&quot;);
 	jsonString = [NSString stringWithContentsOfFile:testFilePath];
 	STAssertNotNil(jsonString, @&quot;Could not create an NSString from the file at path %@&quot;, testFilePath);
@@ -72,7 +72,7 @@
 	STAssertEquals(500, width, @&quot;Expected value of 500, but got %i&quot;, width);
 
 	// test 'json_test_valid_04.txt&quot;
-	testFilePath = [[NSBundle mainBundle] pathForResource:@&quot;json_test_valid_04&quot; ofType:@&quot;txt&quot;];
+	testFilePath = [[NSBundle bundleForClass:[self class]] pathForResource:@&quot;json_test_valid_04&quot; ofType:@&quot;txt&quot;];
 	STAssertNotNil(testFilePath, @&quot;Could not find the test file named \&quot;json_test_valid_04.txt\&quot;&quot;);
 	jsonString = [NSString stringWithContentsOfFile:testFilePath];
 	STAssertNotNil(jsonString, @&quot;Could not create an NSString from the file at path %@&quot;, testFilePath);
@@ -85,7 +85,7 @@
 	// value checks
 	
 	// test 'json_test_valid_05.txt&quot;
-	testFilePath = [[NSBundle mainBundle] pathForResource:@&quot;json_test_valid_05&quot; ofType:@&quot;txt&quot;];
+	testFilePath = [[NSBundle bundleForClass:[self class]] pathForResource:@&quot;json_test_valid_05&quot; ofType:@&quot;txt&quot;];
 	STAssertNotNil(testFilePath, @&quot;Could not find the test file named \&quot;json_test_valid_05.txt\&quot;&quot;);
 	jsonString = [NSString stringWithContentsOfFile:testFilePath];
 	STAssertNotNil(jsonString, @&quot;Could not create an NSString from the file at path %@&quot;, testFilePath);
@@ -102,7 +102,7 @@
 	STAssertEquals([NSNull null], [[dict valueForKeyPath:@&quot;menu.items&quot;] objectAtIndex:2], @&quot;Expected a null value in index 2&quot;);
 	
 	// test 'json_test_valid_06.txt&quot;
-	testFilePath = [[NSBundle mainBundle] pathForResource:@&quot;json_test_valid_06&quot; ofType:@&quot;txt&quot;];
+	testFilePath = [[NSBundle bundleForClass:[self class]] pathForResource:@&quot;json_test_valid_06&quot; ofType:@&quot;txt&quot;];
 	STAssertNotNil(testFilePath, @&quot;Could not find the test file named \&quot;json_test_valid_06.txt\&quot;&quot;);
 	jsonString = [NSString stringWithContentsOfFile:testFilePath];
 	STAssertNotNil(jsonString, @&quot;Could not create an NSString from the file at path %@&quot;, testFilePath);</diff>
      <filename>Unit Tests/JSONValidTests.m</filename>
    </modified>
    <modified>
      <diff>@@ -10,21 +10,24 @@
 
 - (void)testDictionaryEncoding
 {
-  NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
-    [NSNumber numberWithInt: 31], @&quot;age&quot;,
-    @&quot;John Smith&quot;, @&quot;name&quot;,
-    [NSNumber numberWithBool: YES], @&quot;employed&quot;,
-    [NSArray arrayWithObjects: @&quot;football&quot;, @&quot;tv&quot;, nil], @&quot;hobbies&quot;,
-    [NSDictionary dictionaryWithObjectsAndKeys: @&quot;perfect&quot;, @&quot;English&quot;, @&quot;good&quot;, @&quot;German&quot;, nil], @&quot;languages&quot;,
-    nil];
-
-  NSString *encoded = [dict jsonStringValue];
-  NSString *expected = @&quot;{\n \&quot;hobbies\&quot; : [\&quot;football\&quot;, \&quot;tv\&quot;],\n \&quot;age\&quot; : 31,\n \&quot;name\&quot; : \&quot;John Smith\&quot;,&quot;
-                        &quot;\n \&quot;employed\&quot; : true,&quot;
-                        &quot;\n \&quot;languages\&quot; : {\n\t \&quot;English\&quot; : \&quot;perfect\&quot;,\n\t \&quot;German\&quot; : \&quot;good\&quot;}}&quot;;
-
-  STAssertNotNil(encoded, @&quot;Encoding result was nil.&quot;);
-  STAssertEqualObjects(expected, encoded, @&quot;Dictionary was incorrectly encoded&quot;);
+	NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
+						  [NSNumber numberWithInt: 31], @&quot;age&quot;,
+						  @&quot;John Smith&quot;, @&quot;name&quot;,
+						  [NSNumber numberWithBool: YES], @&quot;employed&quot;,
+						  [NSArray arrayWithObjects: @&quot;football&quot;, @&quot;tv&quot;, nil], @&quot;hobbies&quot;,
+						  [NSDictionary dictionaryWithObjectsAndKeys: @&quot;perfect&quot;, @&quot;English&quot;, @&quot;good&quot;, @&quot;German&quot;, nil], @&quot;languages&quot;,
+						  nil];
+	
+	// Encode dictionary as JSON representation
+	NSString *encoded = [dict jsonStringValue];
+	STAssertNotNil(encoded, @&quot;Encoding result was nil.&quot;);
+	
+	// Decode JSON representation as a dictionary.
+	NSDictionary *decodedDict = [NSDictionary dictionaryWithJSONString:encoded];
+	STAssertNotNil( decodedDict, @&quot;Decoding result was nil&quot; );
+	
+	// Test JSON encoding validity by comparing the decoded dictionary with the original.  If the JSON dictionary encoding is bad, the decoded dictionary derived from it will not be equal to the original.
+	STAssertEqualObjects(decodedDict, dict, @&quot;Dictionary was incorrectly encoded&quot;);
 }
 
 @end</diff>
      <filename>Unit Tests/NSDictionary_UnitTests.m</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>0044bf82e420f1082172176e57fb1be31a13ff8b</id>
    </parent>
  </parents>
  <author>
    <name>BSS</name>
    <email>bgarrison@runabout.(none)</email>
  </author>
  <url>http://github.com/blakeseely/bsjsonadditions/commit/fdbeee7e9b015fa076884a07771073b8ed63d271</url>
  <id>fdbeee7e9b015fa076884a07771073b8ed63d271</id>
  <committed-date>2009-09-25T10:46:36-07:00</committed-date>
  <authored-date>2009-09-25T10:46:36-07:00</authored-date>
  <message>Minimal mods to fix issue #1</message>
  <tree>f5708c062d183496df8c5f38d4122e07e3877cd7</tree>
  <committer>
    <name>BSS</name>
    <email>bgarrison@runabout.(none)</email>
  </committer>
</commit>
