Skip to content
This repository
Newer
Older
100644 84 lines (69 sloc) 3.251 kb
97db2410 »
2011-02-11 Implemented possibility to add arbitrary documentation. Closes #7.
1 //
2 // GBDocumentDataTesting.m
3 // appledoc
4 //
5 // Created by Tomaz Kragelj on 10.2.11.
6 // Copyright (C) 2011 Gentle Bytes. All rights reserved.
7 //
8
9 #import "GBDataObjects.h"
10 #import "GBApplicationSettingsProvider.h"
11
12 @interface GBDocumentDataTesting : GHTestCase
13 @end
14
15 @implementation GBDocumentDataTesting
16
17 #pragma mark Initializers testing
18
19 - (void)testInitWithContentsData_shouldCreateCommentWithContentsAsStringValue {
20 // setup & execute
21 GBDocumentData *document = [GBDocumentData documentDataWithContents:@"contents" path:@"path"];
22 // verify
23 assertThat(document.comment, isNot(nil));
24 assertThat(document.comment.stringValue, is(@"contents"));
25 }
26
27 - (void)testInitWithContentsData_shouldCreateSourceInfoUsingThePathAsFilename {
28 // setup & execute
29 GBDocumentData *document = [GBDocumentData documentDataWithContents:@"contents" path:@"path/to/document.ext"];
30 // verify
31 assertThatInteger([document.sourceInfos count], equalToInteger(1));
32 assertThatInteger([[document.sourceInfos anyObject] lineNumber], equalToInteger(1));
33 assertThat([[document.sourceInfos anyObject] filename], is(@"document.ext"));
34 }
35
36 - (void)testInitWithContentsData_shouldAssignNameOfDocument {
37 // setup & execute
38 GBDocumentData *document = [GBDocumentData documentDataWithContents:@"contents" path:@"path/document.extension"];
39 // verify
40 assertThat(document.nameOfDocument, is(@"document.extension"));
41 }
42
43 - (void)testInitWithContentsData_shouldAssignPathOfDocument {
44 // setup & execute
45 GBDocumentData *document = [GBDocumentData documentDataWithContents:@"contents" path:@"path/document.extension"];
46 // verify
47 assertThat(document.pathOfDocument, is(@"path/document.extension"));
48 }
49
50 #pragma mark Convenience methods testing
51
52 - (void)testSubpathOfDocument_shouldReturnProperValue {
53 // setup & execute
54 GBDocumentData *document1 = [GBDocumentData documentDataWithContents:@"c" path:@"document.ext" basePath:@""];
55 GBDocumentData *document2 = [GBDocumentData documentDataWithContents:@"c" path:@"path/sub/document.ext" basePath:@""];
56 GBDocumentData *document3 = [GBDocumentData documentDataWithContents:@"c" path:@"path/document.ext" basePath:@"path"];
57 GBDocumentData *document4 = [GBDocumentData documentDataWithContents:@"c" path:@"path/sub/document.ext" basePath:@"path"];
58 GBDocumentData *document5 = [GBDocumentData documentDataWithContents:@"c" path:@"path/sub/document.ext" basePath:@"path/sub"];
59 // verify
60 assertThat(document1.subpathOfDocument, is(@"document.ext"));
61 assertThat(document2.subpathOfDocument, is(@"path/sub/document.ext"));
62 assertThat(document3.subpathOfDocument, is(@"document.ext"));
63 assertThat(document4.subpathOfDocument, is(@"sub/document.ext"));
64 assertThat(document5.subpathOfDocument, is(@"document.ext"));
65 }
66
67 #pragma mark Overriden methods
68
69 - (void)testIsStaticDocument_shouldReturnYES {
70 // setup & execute
71 GBDocumentData *document = [GBDocumentData documentDataWithContents:@"contents" path:@"path"];
72 // verify
73 assertThatBool(document.isStaticDocument, equalToBool(YES));
74 }
75
76 - (void)testIsTopLevelObject_shouldReturnNO {
77 // setup & execute
78 GBDocumentData *document = [GBDocumentData documentDataWithContents:@"contents" path:@"path"];
79 // verify
80 assertThatBool(document.isTopLevelObject, equalToBool(NO));
81 }
82
83 @end
Something went wrong with that request. Please try again.