Overview
Comment: | Migrate OFXMLNodeTests to ObjFWTest |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | objfwtest |
Files: | files | file ages | folders |
SHA3-256: |
fd477d1a542fdd9f7997b5a1970ac78e |
User & Date: | js on 2024-02-18 18:53:36 |
Other Links: | branch diff | manifest | tags |
Context
2024-02-18
| ||
19:13 | Migrate OFValueTests to ObjFWTest check-in: a14df8d891 user: js tags: objfwtest | |
18:53 | Migrate OFXMLNodeTests to ObjFWTest check-in: fd477d1a54 user: js tags: objfwtest | |
18:27 | Migrate OFXMLParserTests to ObjFWTest check-in: cd1532bb40 user: js tags: objfwtest | |
Changes
Modified new_tests/Makefile from [7f1203c5b5] to [8515f58790].
︙ | ︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 62 63 | OFPropertyListTests.m \ OFScryptTests.m \ OFSetTests.m \ OFStringTests.m \ OFSystemInfoTests.m \ OFUTF8StringTests.m \ OFXMLElementBuilderTests.m \ OFXMLParserTests.m \ ${RUNTIME_ARC_TESTS_M} \ RuntimeTests.m \ ${USE_SRCS_PLUGINS} \ ${USE_SRCS_SOCKETS} \ ${USE_SRCS_SUBPROCESSES} \ ${USE_SRCS_THREADS} \ | > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | OFPropertyListTests.m \ OFScryptTests.m \ OFSetTests.m \ OFStringTests.m \ OFSystemInfoTests.m \ OFUTF8StringTests.m \ OFXMLElementBuilderTests.m \ OFXMLNodeTests.m \ OFXMLParserTests.m \ ${RUNTIME_ARC_TESTS_M} \ RuntimeTests.m \ ${USE_SRCS_PLUGINS} \ ${USE_SRCS_SOCKETS} \ ${USE_SRCS_SUBPROCESSES} \ ${USE_SRCS_THREADS} \ |
︙ | ︙ |
Renamed and modified tests/OFXMLNodeTests.m [806daf51ab] to new_tests/OFXMLNodeTests.m [eb43bc25ed].
︙ | ︙ | |||
11 12 13 14 15 16 17 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" | | > | > | | < < | > > | < | < < | < > | | | | < < < < < < < < < < < < < | < < < < < | < < < | < < < | > > | | > | | < | | < | | | < | | < | < < < | | > | | | < < < < < < < < < | < < < < < | < | | | | | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > | > > > | > > > > > > > > > > > | > > > > > > > | > > | | | < < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "ObjFW.h" #import "ObjFWTest.h" @interface OFXMLNodeTests: OTTestCase @end @implementation OFXMLNodeTests - (void)testElementWithName { OTAssertEqualObjects( [[OFXMLElement elementWithName: @"foo"] XMLString], @"<foo/>"); } - (void)testElementWithNameStringValue { OTAssertEqualObjects( [[OFXMLElement elementWithName: @"foo" stringValue: @"b&ar"] XMLString], @"<foo>b&ar</foo>"); } - (void)testElementWithNameNamespace { OFXMLElement *element; element = [OFXMLElement elementWithName: @"foo" namespace: @"urn:objfw:test"]; [element addAttributeWithName: @"test" stringValue: @"test"]; [element setPrefix: @"objfw-test" forNamespace: @"urn:objfw:test"]; OTAssertEqualObjects(element.XMLString, @"<objfw-test:foo test='test'/>"); element = [OFXMLElement elementWithName: @"foo" namespace: @"urn:objfw:test"]; [element addAttributeWithName: @"test" stringValue: @"test"]; OTAssertEqualObjects(element.XMLString, @"<foo xmlns='urn:objfw:test' test='test'/>"); } - (void)testElementWithNameNamespaceStringValue { OFXMLElement *element = [OFXMLElement elementWithName: @"foo" namespace: @"urn:objfw:test" stringValue: @"x"]; [element setPrefix: @"objfw-test" forNamespace: @"urn:objfw:test"]; OTAssertEqualObjects(element.XMLString, @"<objfw-test:foo>x</objfw-test:foo>"); } - (void)testElementWithXMLStringAndStringValue { OTAssertEqualObjects([[OFXMLElement elementWithXMLString: @"<?xml version='1.0' encoding='UTF-8'?>\r\n<x>foo<![CDATA[bar]]>" @"<y>b<!-- fooo -->az</y>qux</x>"] stringValue], @"foobarbazqux"); } - (void)testCharactersWithString { OTAssertEqualObjects( [[OFXMLCharacters charactersWithString: @"<foo>"] XMLString], @"<foo>"); } - (void)testCDATAWithString { OTAssertEqualObjects( [[OFXMLCDATA CDATAWithString: @"<foo>"] XMLString], @"<![CDATA[<foo>]]>"); } - (void)testCommentWithText { OTAssertEqualObjects( [[OFXMLComment commentWithText: @" comment "] XMLString], @"<!-- comment -->"); } - (void)testIsEqual { OTAssertEqualObjects( [OFXMLElement elementWithXMLString: @"<foo bar='asd'/>"], [OFXMLElement elementWithXMLString: @"<foo bar='asd'></foo>"]); OTAssertEqualObjects( [OFXMLElement elementWithXMLString: @"<x><y/></x>"], [OFXMLElement elementWithXMLString: @"<x><y></y></x>"]); OTAssertNotEqualObjects( [OFXMLElement elementWithXMLString: @"<x><Y/></x>"], [OFXMLElement elementWithXMLString: @"<x><y></y></x>"]); } - (void)testHash { OTAssertEqual( [[OFXMLElement elementWithXMLString: @"<foo bar='asd'/>"] hash], [[OFXMLElement elementWithXMLString: @"<foo bar='asd'></foo>"] hash]); OTAssertEqual( [[OFXMLElement elementWithXMLString: @"<x><y/></x>"] hash], [[OFXMLElement elementWithXMLString: @"<x><y></y></x>"] hash]); OTAssertNotEqual( [[OFXMLElement elementWithXMLString: @"<x><Y/></x>"] hash], [[OFXMLElement elementWithXMLString: @"<x><y></y></x>"] hash]); } - (void)testAddAttributeWithNameStringValue { OFXMLElement *element = [OFXMLElement elementWithName: @"foo" stringValue: @"b&ar"]; [element setPrefix: @"objfw-test" forNamespace: @"urn:objfw:test"]; [element addAttributeWithName: @"foo" stringValue: @"b&ar"]; [element addAttributeWithName: @"foo" namespace: @"urn:objfw:test" stringValue: @"bar"]; OTAssertEqualObjects(element.XMLString, @"<foo foo='b&ar' objfw-test:foo='bar'>b&ar</foo>"); } - (void)testRemoveAttributeForNameNamespace { OFXMLElement *element = [OFXMLElement elementWithName: @"foo" stringValue: @"b&ar"]; [element setPrefix: @"objfw-test" forNamespace: @"urn:objfw:test"]; [element addAttributeWithName: @"foo" stringValue: @"b&ar"]; [element addAttributeWithName: @"foo" namespace: @"urn:objfw:test" stringValue: @"bar"]; [element removeAttributeForName: @"foo"]; OTAssertEqualObjects(element.XMLString, @"<foo objfw-test:foo='bar'>b&ar</foo>"); [element removeAttributeForName: @"foo" namespace: @"urn:objfw:test"]; OTAssertEqualObjects(element.XMLString, @"<foo>b&ar</foo>"); } - (void)testAddChild { OFXMLElement *element; element = [OFXMLElement elementWithName: @"foo"]; [element addAttributeWithName: @"foo" stringValue: @"b&ar"]; [element addChild: [OFXMLElement elementWithName: @"bar"]]; OTAssertEqualObjects(element.XMLString, @"<foo foo='b&ar'><bar/></foo>"); element = [OFXMLElement elementWithName: @"foo" namespace: @"urn:objfw:test"]; [element setPrefix: @"objfw-test" forNamespace: @"urn:objfw:test"]; [element addAttributeWithName: @"test" stringValue: @"test"]; [element addChild: [OFXMLElement elementWithName: @"bar" namespace: @"urn:objfw:test"]]; OTAssertEqualObjects(element.XMLString, @"<objfw-test:foo test='test'><objfw-test:bar/></objfw-test:foo>"); } - (void)testElementsForNameNamespace { OFXMLElement *element = [OFXMLElement elementWithName: @"foo"]; OFXMLElement *bar; [element addChild: [OFXMLElement elementWithName: @"foo"]]; bar = [OFXMLElement elementWithName: @"bar" namespace: @"urn:objfw:test"]; [element addChild: bar]; OTAssertEqualObjects([element elementsForName: @"bar" namespace: @"urn:objfw:test"], [OFArray arrayWithObject: bar]); } - (void)testXMLStringWithIndentation { OTAssertEqualObjects([[OFXMLElement elementWithXMLString: @"<x><y><z>a\nb</z><!-- foo --></y></x>"] XMLStringWithIndentation: 2], @"<x>\n <y>\n <z>a\nb</z>\n <!-- foo -->\n </y>\n</x>"); } @end |
Modified tests/Makefile from [2b37063ded] to [c7ade39e1a].
︙ | ︙ | |||
11 12 13 14 15 16 17 | ${PROG_NOINST}.rpx DISTCLEAN = Info.plist PROG_NOINST = tests${PROG_SUFFIX} STATIC_LIB_NOINST = ${TESTS_STATIC_LIB} SRCS = OFStreamTests.m \ OFValueTests.m \ | < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ${PROG_NOINST}.rpx DISTCLEAN = Info.plist PROG_NOINST = tests${PROG_SUFFIX} STATIC_LIB_NOINST = ${TESTS_STATIC_LIB} SRCS = OFStreamTests.m \ OFValueTests.m \ TestsAppDelegate.m IOS_USER ?= mobile IOS_TMP ?= /tmp/objfw-test include ../buildsys.mk |
︙ | ︙ |
Modified tests/TestsAppDelegate.h from [ba574a9222] to [5a2edc0b1c].
︙ | ︙ | |||
62 63 64 65 66 67 68 | @interface TestsAppDelegate (OFStreamTests) - (void)streamTests; @end @interface TestsAppDelegate (OFValueTests) - (void)valueTests; @end | < < < < | 62 63 64 65 66 67 68 | @interface TestsAppDelegate (OFStreamTests) - (void)streamTests; @end @interface TestsAppDelegate (OFValueTests) - (void)valueTests; @end |
Modified tests/TestsAppDelegate.m from [4407e4999c] to [01900772f3].
︙ | ︙ | |||
368 369 370 371 372 373 374 | #if defined(OF_WII) && defined(OF_HAVE_FILES) [[OFFileManager defaultManager] changeCurrentDirectoryPath: @"/apps/objfw-tests"]; #endif [self valueTests]; [self streamTests]; | < | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | #if defined(OF_WII) && defined(OF_HAVE_FILES) [[OFFileManager defaultManager] changeCurrentDirectoryPath: @"/apps/objfw-tests"]; #endif [self valueTests]; [self streamTests]; [OFStdOut reset]; #if defined(OF_IOS) [OFStdOut writeFormat: @"%d tests failed!", _fails]; [OFApplication terminateWithStatus: _fails]; #elif defined(OF_WII) |
︙ | ︙ |