Add _unicodeString method to return GSUnicodeString subclass instance for tests

This commit is contained in:
Richard Frith-Macdonald 2018-02-27 15:00:52 +00:00
parent 2f3fcb98e0
commit c6e4220409

View file

@ -1100,6 +1100,23 @@ tsbytes(uintptr_t s, char *buf)
return 8;
}
/* This method is provided to enable regression tests to ensure they are
* using an object whose internal representation is wide (unicode) text,
* so that all the comparison operations between 8bit and 16bit strings
* can be tested.
*/
- (NSString*) _unicodeString
{
GSUInlineString *o;
unsigned i = [self length];
o = [newUInline(i, [self zone]) autorelease];
while (i-- > 0)
{
o->_contents.u[i] = [self characterAtIndex: i];
}
return o;
}
@end
/**
@ -3845,6 +3862,23 @@ transmute(GSStr self, NSString *aString)
return size;
}
/* This method is provided to enable regression tests to ensure they are
* using an object whose internal representation is wide (unicode) text,
* so that all the comparison operations between 8bit and 16bit strings
* can be tested.
*/
- (NSString*) _unicodeString
{
GSUInlineString *o;
unsigned i = [self length];
o = [newUInline(i, [self zone]) autorelease];
while (i-- > 0)
{
o->_contents.u[i] = [self characterAtIndex: i];
}
return o;
}
@end
@ -4556,6 +4590,15 @@ agree, create a new GSUInlineString otherwise.
}
}
/* This method is provided to enable regression tests to ensure they are
* using an object whose internal representation is wide (unicode) text,
* so that all the comparison operations between 8bit and 16bit strings
* can be tested.
*/
- (NSString*) _unicodeString
{
return self;
}
@end
@ -6249,6 +6292,23 @@ literalIsEqual(NXConstantString *self, id anObject)
return NSUTF8StringEncoding;
}
/* This method is provided to enable regression tests to ensure they are
* using an object whose internal representation is wide (unicode) text,
* so that all the comparison operations between 8bit and 16bit strings
* can be tested.
*/
- (NSString*) _unicodeString
{
GSUInlineString *o;
unsigned i = [self length];
o = [newUInline(i, [self zone]) autorelease];
while (i-- > 0)
{
o->_contents.u[i] = [self characterAtIndex: i];
}
return o;
}
@end