Permalink
Browse files

Added tests for KWFormatter

  • Loading branch information...
1 parent 877233d commit 652d62be5b9f60995728a56753dbabe0fc0c0a02 Marin Usalj committed Mar 23, 2013
Showing with 41 additions and 0 deletions.
  1. +4 −0 Kiwi.xcodeproj/project.pbxproj
  2. +37 −0 Tests/KWFormatterTest.m
@@ -121,6 +121,7 @@
511901A616A95CDE006E7359 /* KWChangeMatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 511901A316A95CDE006E7359 /* KWChangeMatcher.h */; };
511901A716A95CDE006E7359 /* KWChangeMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 511901A416A95CDE006E7359 /* KWChangeMatcher.m */; };
511901A816A95CDE006E7359 /* KWChangeMatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 511901A416A95CDE006E7359 /* KWChangeMatcher.m */; };
+ 89861D9416FE0EE5008CE99D /* KWFormatterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 89861D9316FE0EE5008CE99D /* KWFormatterTest.m */; };
89F9CB7C16B1C2C400E87D34 /* KWFunctionalTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 89F9CB7B16B1C2C400E87D34 /* KWFunctionalTests.m */; };
9F820DB816BB6748003A1BA5 /* NSProxy+KiwiVerifierAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F820DB616BB6748003A1BA5 /* NSProxy+KiwiVerifierAdditions.h */; };
9F820DB916BB6748003A1BA5 /* NSProxy+KiwiVerifierAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F820DB616BB6748003A1BA5 /* NSProxy+KiwiVerifierAdditions.h */; };
@@ -639,6 +640,7 @@
6B39D95F155C9FCB003C3444 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
6B39D960155C9FCB003C3444 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
832C83C7157263B300F160D5 /* libKiwi-OSX.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libKiwi-OSX.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 89861D9316FE0EE5008CE99D /* KWFormatterTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWFormatterTest.m; sourceTree = "<group>"; };
89F9CB7B16B1C2C400E87D34 /* KWFunctionalTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWFunctionalTests.m; sourceTree = "<group>"; };
9F4C095816B16A6D00FCCCD3 /* Release.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = Release.txt; sourceTree = "<group>"; };
9F820DB616BB6748003A1BA5 /* NSProxy+KiwiVerifierAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSProxy+KiwiVerifierAdditions.h"; path = "Classes/NSProxy+KiwiVerifierAdditions.h"; sourceTree = "<group>"; };
@@ -1274,6 +1276,7 @@
F55E61CD119B74D600F30B42 /* KWMessagePatternTest.m */,
F5FC83B511B100B100BF98A2 /* KWStringUtilitiesTest.m */,
F5C6FD2311782A290068BBC8 /* KWValueTest.m */,
+ 89861D9316FE0EE5008CE99D /* KWFormatterTest.m */,
);
name = Support;
sourceTree = "<group>";
@@ -1901,6 +1904,7 @@
89F9CB7C16B1C2C400E87D34 /* KWFunctionalTests.m in Sources */,
9F820DBC16BB6808003A1BA5 /* KWChangeMatcherTest.m in Sources */,
492F3A7A16D5F7DC008E3C49 /* KWFailureTest.m in Sources */,
+ 89861D9416FE0EE5008CE99D /* KWFormatterTest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
@@ -0,0 +1,37 @@
+//
+// KWFormatterTest.m
+// Kiwi
+//
+// Created by Marin Usalj on 3/23/13.
+// Copyright (c) 2013 Allen Ding. All rights reserved.
+//
+
+#import "Kiwi.h"
+#import "KiwiTestConfiguration.h"
+
+#if KW_TESTS_ENABLED
+
+@interface KWFormatterTest : SenTestCase
+
+@end
+
+@implementation KWFormatterTest
+
+- (void)testFormatsStringsWithQuotes {
+ NSString *sampleString = @"sample";
+ STAssertEqualObjects(@"\"sample\"", [KWFormatter formatObject:sampleString], @"String should be surrounded with quotes");
+}
+
+- (void)testFormatsEnumerableCollectionsInline {
+ NSArray *sampleArray = @[@1, @2, @3];
+ STAssertEqualObjects(@"(1, 2, 3)", [KWFormatter formatObject:sampleArray], @"Array objects should be formatted inline");
+}
+
+- (void)testFormatsDictionariesWithKeysAndValuesMultiline {
+ NSDictionary *sampleDict = @{ @"foo" : @"bar", @"baz" : @"bang" };
+ STAssertEqualObjects([sampleDict description], [KWFormatter formatObject:sampleDict], @"Dictionaries should be not treated as NSEnumerable");
+}
+
+@end
+
+#endif // #if KW_TESTS_ENABLED

0 comments on commit 652d62b

Please sign in to comment.