ObjFW  Check-in [efb964a3ae]

Overview
Comment:OFStringTests: Fix a new Clang warning

The idea was to have garbage before and remove it with the + 3, to
prevent compilers from potentially being smart in the future and
stripping the BOM. This hasn't happened, and instead they got smarter
with warnings, to remove that hack.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: efb964a3ae85b0749391ad5596f889ebbb5164de161d8ef945ad16ec38cf1e08
User & Date: js on 2019-04-14 10:59:11
Other Links: manifest | tags
Context
2019-04-14
13:35
runtime: Match Apple's +[initialize] behavior check-in: ede088a30d user: js tags: trunk
10:59
OFStringTests: Fix a new Clang warning check-in: efb964a3ae user: js tags: trunk
2019-04-11
00:34
Make OFFileManager available with --disable-files check-in: c52f38388c user: js tags: trunk
Changes

Modified tests/OFStringTests.m from [c166811b76] to [e7c58a38d5].

352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
	TEST(@"+[stringWithContentsOfURL:encoding]", (is = [stringClass
	    stringWithContentsOfURL: [OFURL fileURLWithPath: @"testfile.txt"]
			   encoding: OF_STRING_ENCODING_ISO_8859_1]) &&
	    [is isEqual: @"testäöü"])
#endif

	TEST(@"-[appendUTFString:length:]",
	    R([s[0] appendUTF8String: "foo\xEF\xBB\xBF" "barqux" + 3
			      length: 6]) && [s[0] isEqual: @"foobar"])

	EXPECT_EXCEPTION(@"Detection of invalid UTF-8 encoding #1",
	    OFInvalidEncodingException,
	    [stringClass stringWithUTF8String: "\xE0\x80"])
	EXPECT_EXCEPTION(@"Detection of invalid UTF-8 encoding #2",
	    OFInvalidEncodingException,







|







352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
	TEST(@"+[stringWithContentsOfURL:encoding]", (is = [stringClass
	    stringWithContentsOfURL: [OFURL fileURLWithPath: @"testfile.txt"]
			   encoding: OF_STRING_ENCODING_ISO_8859_1]) &&
	    [is isEqual: @"testäöü"])
#endif

	TEST(@"-[appendUTFString:length:]",
	    R([s[0] appendUTF8String: "\xEF\xBB\xBF" "barqux"
			      length: 6]) && [s[0] isEqual: @"foobar"])

	EXPECT_EXCEPTION(@"Detection of invalid UTF-8 encoding #1",
	    OFInvalidEncodingException,
	    [stringClass stringWithUTF8String: "\xE0\x80"])
	EXPECT_EXCEPTION(@"Detection of invalid UTF-8 encoding #2",
	    OFInvalidEncodingException,