mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Add test to ensure that NSData assigns bytes
and length
Specifically on initWithBytesNoCopy:length:deallocator:
This commit is contained in:
parent
d439847ba6
commit
9684c9fda1
1 changed files with 4 additions and 0 deletions
|
@ -89,6 +89,8 @@ int main()
|
|||
deallocator: ^(void* bytes, NSUInteger length) {
|
||||
called++;
|
||||
}];
|
||||
PASS([immutable length] == 4, "Length set");
|
||||
PASS([immutable bytes] == stackBuf, "Bytes set");
|
||||
PASS_RUNS([immutable release]; immutable = nil;,
|
||||
"No free() error with custom deallocator");
|
||||
PASS(called == 1, "Deallocator block called");
|
||||
|
@ -102,6 +104,8 @@ int main()
|
|||
called++;
|
||||
}
|
||||
];
|
||||
PASS([mutable length] == 4, "Length set");
|
||||
PASS([mutable bytes] == buf, "Bytes set");
|
||||
PASS_RUNS([mutable release]; mutable = nil;,
|
||||
"No free() error with custom deallocator on mutable data");
|
||||
PASS(called == 2, "Deallocator block called on -dealloc of mutable data");
|
||||
|
|
Loading…
Reference in a new issue