Commit graph

868 commits

Author SHA1 Message Date
rfm
7bb34b7102 Prodyce more informative logging 2024-12-31 12:17:52 +00:00
rfm
0ede979d15 Fixes for tests with weak pointers in notification observers. 2024-12-28 07:48:32 +00:00
rfm
bdf4403195 Weak pointer support fixes and use for notification observers. 2024-12-28 07:48:32 +00:00
rfm
c66bd6ec5c Preliminary code for emulation of the objc2 runtime weak reference feature 2024-12-28 07:48:32 +00:00
rfm
34112fa510 Fix leaks in tests 2024-12-23 17:38:14 +00:00
rfm
394d858813 Fix leaks in tests 2024-12-23 13:16:14 +00:00
Hugo Melder
3f27cb0d23 NSKVOSupport: Mark proxy test as hopeful 2024-12-13 03:29:30 -08:00
Hugo Melder
cd09be4c53 NSKVOSupport: Move ivar block to declaration
GCC does not support private ivar definitions in the implementation
block.
2024-12-13 03:29:30 -08:00
Hugo Melder
d4de228c6f NSKVOSupport: Add observer via proxy test
The new KVO implementation for libobjc2/clang, located in Source/NSKVO*, reuses
or installs a hidden class and subsequently adds the swizzled method to the
hidden class. Make sure that the invocation mechanism calls the swizzled method.
2024-12-13 03:29:30 -08:00
Hugo Melder
4b3bd1aa90
NSPointerArray: Implement fast enumeration (#477)
* NSPointerArray: Implement NSFastEnumeration

* NSPointerArray: Test for duplicate values in array

* NSPointerArray: Fast enumeration tests
2024-12-13 12:01:07 +01:00
rfm
e231fe2067 Increase timeout for slow testcase on mingw 2024-12-05 14:00:37 +00:00
rfm
2de7793dbc copy cache key in case it is mutated 2024-12-04 19:43:45 +00:00
rfm
9cdb4f98ba asan fixes for gcc and gnu runtime 2024-11-30 19:06:40 +00:00
rfm
018111efbb LeakSanitizer fixups for gcc and gnu runtime 2024-11-30 18:23:48 +00:00
Matvii Jarosh
410b295b01 Add EdgeInsets missing function in value 2024-11-21 13:01:31 +02:00
rfm
6f02b87ae1 Fix compiler warnings about variable size 2024-11-19 09:28:19 +00:00
rfm
bb4bcaff9d Fix leak 2024-11-18 19:17:16 +00:00
rfm
67eeb932d1 Add tests for class and protocol lists 2024-11-18 14:33:52 +00:00
rfm
240df48ec8 Avoid deadlock in cleanup functions/methods called by atexit() 2024-11-18 09:19:04 +00:00
rfm
96bbc05b18 More leak fixups 2024-11-17 21:41:43 +00:00
rfm
9e504da2df Don't have the subtask crash when logging zombie message. 2024-11-17 20:50:17 +00:00
rfm
2c9e521789 allow more time for slow tests 2024-11-17 19:31:54 +00:00
rfm
cd3e69245d More leak management fixes 2024-11-17 16:16:46 +00:00
rfm
90082eccac Revert last change 2024-11-17 15:03:22 +00:00
rfm
7cff5fc106 Fix more leaks 2024-11-17 13:32:31 +00:00
rfm
0fb9739f21 Fix leaks and a possible buffer overrun 2024-11-17 12:55:55 +00:00
rfm
5b46efa8cd More leak fixes 2024-11-16 21:11:56 +00:00
rfm
c7f0c27dd7 More leaks fixed 2024-11-16 14:07:33 +00:00
rfm
aedd13dc94 More leaks fixed 2024-11-16 13:34:56 +00:00
rfm
87c50830e2 Fix some more leaks 2024-11-16 11:51:53 +00:00
rfm
088b76bed1 Fix leaks 2024-11-15 21:21:41 +00:00
rfm
77c66e3d95 Fix leaks 2024-11-15 20:48:09 +00:00
rfm
093ab72a47 Fix leaks 2024-11-15 16:00:47 +00:00
rfm
91be2c2c83 Fix leaks 2024-11-15 15:44:39 +00:00
rfm
2f9f0d6761 Fix leaks 2024-11-15 13:00:56 +00:00
rfm
a1e17402cf fix leaks 2024-11-15 12:27:48 +00:00
rfm
36822d6eef Fix leaks 2024-11-15 11:00:57 +00:00
rfm
6386ac5474 Fix leaks 2024-11-15 10:49:19 +00:00
rfm
2f3b258bd1 Fix leaks 2024-11-15 10:44:29 +00:00
rfm
050f44806c fix leaks 2024-11-14 20:26:37 +00:00
rfm
43484b2c34 Fix deallocation of placeholder strings at exit. 2024-11-14 16:18:26 +00:00
rfm
28ba7788ce Fix the case where we replace a value already in the map 2024-11-12 14:27:06 +00:00
rfm
b78b2e2030 hash/map table and pointer functions fixups 2024-11-12 12:03:24 +00:00
rfm
c981920679 Revert "Retain count fixes"
This reverts commit 544dcce482.
2024-11-10 20:13:39 +00:00
Hugo Melder
6681a3da47
Initial port of WinObjC's KVO implementation to GNUstep (#420)
* GSAtomic: Add prefix to macro definitions

* NSKVOSupport: Import

* NSKVOSupport: Add test cases

* NSKVOSwizzling: Ugly C Rewrite

* NSKeyValueObserving: Use old implementation as fallback

* NSKeyValueObserving: Rename TypeEncodingCases header

* NSKVOSupport: Fix new objects not being added to NSKeyValueChangeNew set on set mutation

* NSKeyValueMutableSet: Fix will and didChange notifications for set operations

* NSKeyValueMutableSet: Document Accessor Search Patterns

* NSKVOSupport: Add toMany test

* NSKeyValueCoding: Change notifications when changing value via setValue:forKey:

* NSKVOSupport: Add more tests

* NSKVOSupport: Do not wrap block in try/finally to avoid crash in windows

* NSKVOSwizzling: use _alloca on Windows

* NSKVOSupport: Do not autorelease newWithObservee:

* NSKVOSupport: Do not leak Observee and TestFacade objects

* Improve runtime detection in makefile

* Add file extension of source file in GNUMakefile

* NSKVOSupport: Remove @status comments

* NSKVOSupport: Implement private notify method

* NSUserDefaults: KVO Support and fix macOS incompatibilities

* NSKeyValueObserving: Set old to null if nil

* NSKeyValueObserving: Remove cached new value

* NSMethodSignature: Add signature cache

* NSKVOSupport: Remove ObjC2 features and mark tests failing on GCC as hopeful

* Call class method instead of private _keyPathsForValuesAffectingValueForKey

* Move _keyPathsForValuesAffectingValueForKey body into class method and statically construct empty NSSet

* NSUserDefaults: Change notification should contain old value from other domains aswell

* NSUserDefaults: Fetch new value from all domains

* NSKVOInternal: Fixup filename in header

* NSUserDefaults: Go through search list instead of only one domain in KVO change

* Making indentation a bit less worse

* Add NSUserDefaults KVO tests

* NSKVOSupport: NSUserDefaults test small fixes

* Add autoreleasepool

* NSUserDefaults: Only emit change notifications if value changed

* Avoid compiler warnings and tidy some of the whitespace/formatting

---------

Co-authored-by: Frederik Seiffert <frederik@algoriddim.com>
Co-authored-by: rfm <richardfrithmacdonald@gmail.com>
Co-authored-by: rfm <rfm@gnu.org>
2024-11-10 17:05:23 +01:00
rfm
544dcce482 Retain count fixes 2024-11-10 14:14:42 +00:00
rfm
44222342b0 Fix for issue 461 2024-11-09 11:09:22 +00:00
rfm
6667842dd5 Update FSF address as requested by Gregory 2024-11-07 13:37:59 +00:00
rfm
7c6ed5fa26 Add tests for -earlierDate: and -laterDate: with equal time instants and where tartget/receiver are different classes. 2024-11-06 15:45:37 +00:00
rfm
9978c055df Reapply "Implement NSDate as a small object (tagged pointer) - clang/libobjc2 only (#451)" because of GUI breakage: apps hang when loading NSMenu
This reverts commit cac43f7bfc.
2024-11-01 08:43:15 +00:00
Riccardo Mottola
cac43f7bfc Revert "Implement NSDate as a small object (tagged pointer) - clang/libobjc2 only (#451)" because of GUI breakage: apps hang when loading NSMenu
This reverts commit 8fd2c06ddd.
2024-10-31 02:13:24 +01:00
rfm
cfc28d82bb NSObject shouldn't support NSCoding 2024-10-29 16:12:14 +00:00
Hugo Melder
6eef1c3289
NSKeyValueCoding: Safe-Caching for -[NSObject valueForKey:] (#445)
* KVC Caching Implementation

* Do not ignore struct name when comparing type encoding as NSPoint and NSSize have the same layout

* Use fast-path when using Objective-C 2

* Guard old ValueForKey function when using the fast-path

* Add basic NSKeyValueCoding tests

* Update Copyright Years

* NSKeyValueCoding+Caching: Add Versioning to IVar Slot

* safe_caching: Remove Guards

* Add type encoding helper header

* Rename geometry structs (NSRect, NSPoint, NSSize) for toll-free bridging with CoreGraphics

* Move CG struct definitions to CFCGTypes.h

* Update known struct encoding prefixes

* Windows 64-bit is LLP64 and not LP64

* Re-order to avoid complier warning

---------

Co-authored-by: rfm <richardfrithmacdonald@gmail.com>
2024-10-29 14:12:34 +01:00
hmelder
4f0a8d60c2 Add missing return value 2024-10-28 14:54:37 +01:00
Hugo Melder
cf4c985e46
NSString: Fix -commonPrefixWithString:options: behaviour (#455)
* Update changelog

* NSString: fix -commonPrefixWithString:options: behaviour

* NSString: More test cases
2024-10-28 14:42:41 +01:00
Hugo Melder
8fd2c06ddd
Implement NSDate as a small object (tagged pointer) - clang/libobjc2 only (#451)
* Implement GSSmallObject Class

* Remove private concrete class access

* Change secondary bias

* NSDate: Get interval from rhs object in comparison

* Add prefix to CONCRETE_CLASS_NAME  macro
2024-10-28 11:52:44 +01:00
Hugo Melder
273776a3c6
Fix CI and make libcurl a hard-dependency when using libobjc2 (#447)
* Do not enable Win32 threads and locks when using GCC

* Fix compiler check when CC has arguments appended

* Add NSConstantString literal as global variable to avoid linker error

* Make libcurl a hard-dependency on ObjC 2.0 Toolchain

* Bump TOOLS_WINDOWS_MSVC_RELEASE_TAG

* Remove x86 runner for MSVC toolchain

* Add libcurl to MinGW x64 Clang toolchain

* MSVC toolchain requires Windows 1903 and newer but windows-2019 runner is Redstone 5 (1809)

* MinGW GCC adds .exe suffix

* Some tests timeout after 30s. Increase timeout

* Mark late unregister as hopeful on Win32 with GCC

* Mark NSURL test depending on network connection as hopeful
2024-10-10 11:16:47 +02:00
Hugo Melder
012947f09e
NSOperationQueue: Proper names for worker threads (#437)
* NSOperationQueue: Give Worker Threads a name

* Update Changelog

* Remove empty string test
2024-09-08 16:54:01 +02:00
rfm
ed4e305026
NSURLSession rewrite (#422)
* clang-format: Do not use tabs

* Ignore clangd cache and compile_commands

* NSBlockOperation: Fix memory leak

* NSHTTPCookie: Fix expires date parsing

* NSHTTPCookie: Release DateFormatter after use

* NSOperation: Remove all objects at end of execution

* Reimplementation of NSURLSession

* NSURLSession: Update expiration dates in test

* Update ChangeLog

* Fix trivial compiler warning caused by missing import

* Import GSDispatch.h for definition of DISPATCH_QUEUE_SERIAL

* Import common.h early to avoid header conflict

* Fix import order to avoid conflicts and ensure we have correct localisation macro

* Check for presence of dispatch_cancel

* Cancel timer using dispatch_source_cancel() if dispatch_cancel() is missing.

* NSURLSession: Replace dispatch_io with dispatch_source in unit test HTTP server

---------

Co-authored-by: hmelder <service@hugomelder.com>
2024-08-16 14:08:41 +02:00
Earl Robsham
a5ed5dbe11
Update -[NSMutableArray removeLastObject] (#433)
* Update `-[NSMutableArray removeLastObject]`

Updates the following implementation to avoid raising an exception if the array is already empty (or notifying observers if applicable):
 * `-[NSMutableArray removeLastObject]`
 * `-[GSMutableArray removeLastObject]`
 * `-[NSKeyValueMutableArray removeLastObject]`
 * `-[NSKeyValueIvarMutableArray removeLastObject]`

This brings the behavior of `-[NSMutableArray removeLastObject]` inline with the Apple implementation, improving compatibility for code bases which use both GNUStep and Apple objc/Foundation implementations.

* Add `-[NSMutableArray removeLastObject]` test case

Adds a test case to ensure `-[NSMutableArray removeLastObject]` does not raise an exception when called on an empty array.
2024-08-10 23:44:02 +02:00
rfm
a1514249f3 Tweaks to match OSX pointer array behaviors more accurately. 2024-07-22 12:22:40 +01:00
Richard Frith-Macdonald
d2fec6b222 a few GC related tests 2024-07-21 09:43:21 +01:00
Richard Frith-Macdonald
42a3e55499 simple test for pointer array and weak objects 2024-07-18 12:43:46 +01:00
Richard Frith-Macdonald
6dd13deac2 fix typo 2024-07-17 16:34:57 +01:00
rfm
7aa05d2591 reinstate lost change 2024-07-17 16:32:50 +01:00
rfm
f6b8c83bd0 Don't crash when built with gcc 2024-07-17 14:14:46 +01:00
Richard Frith-Macdonald
a0a62fbde4 make tests pass on os-x 14.5 2024-07-17 11:32:52 +01:00
rfm
1a1e7f7fc5 Acquiring existing memory does not use a funtion on OSX, copy that behavior. 2024-07-16 19:43:28 +01:00
rfm
8c722deb0c Fix error in testcases due to uninitialsed padding in struct 2024-07-16 14:37:41 +01:00
rfm
d32065b322 fix non-portable testcases 2024-07-16 13:46:09 +01:00
rfm
b677ea402a Add some simple pointer functions personality tests 2024-07-16 12:07:32 +01:00
rfm
3fedf31c2d
Revert "NSURLSession Reimplementation (#411)"
This reverts commit 07233534e6.
2024-07-02 19:19:14 +01:00
Hugo Melder
07233534e6
NSURLSession Reimplementation (#411)
* clang-format: Do not use tabs

* Ignore clangd cache and compile_commands

* NSBlockOperation: Fix memory leak

* NSHTTPCookie: Fix expires date parsing

* NSOperation: Remove all objects at end of execution

* Reimplementation of NSURLSession

* Update ChangeLog
2024-07-02 15:58:48 +02:00
rfm
c79b9844bd fix non-portable code in testcase 2024-06-23 08:20:52 +01:00
Gregory Casamento
ced4cd0531
Merge pull request #410 from gnustep/NSExpression_branch 2024-06-11 11:46:56 -04:00
rfm
3bcb484691
Merge pull request #416 from gnustep/enumerateSubstringInRange
Fix broken enumerateSubstringsInRange:options:usingBlock: implementation
2024-06-11 13:29:48 +01:00
rfm
930b901558 remove obsolete test 2024-06-10 15:27:35 +01:00
Hugo Melder
4d3926d250
Implement -[NSString enumerateLinesUsingBlock:] (#407)
* Implement -[NSString enumerateLinesUsingBlock:]

* Fix formatting

* Use GNUstep CALL_BLOCK macro
2024-06-04 22:19:45 +02:00
hmelder
edbc859093 NSString: Add enumerateSubstringsInRange tests 2024-06-04 12:10:31 +02:00
hmelder
8024082027 NSPredicate: Add tests for constant expressions 2024-05-31 14:24:57 +02:00
Gregory John Casamento
d3d53ab23f Clean up tests 2024-05-31 00:20:09 -04:00
Gregory John Casamento
392a626444 Add missing enum values, add skeleton implementations for metods, add simple tests 2024-05-25 00:39:34 -04:00
Gregory John Casamento
84e1ef9881 Add extremely simple tests to make sure that each of the methods returns non-nil 2024-05-24 23:04:13 -04:00
Doug Simons
0935f77d8f
Merge pull request #405 from gnustep/small_xml_fixes
Two small xml fixes
2024-05-15 09:26:57 -06:00
Frederik Seiffert
6e2bd5c4e8 Fixed missing semicolon in NSURLConnection test 2024-05-15 17:09:00 +02:00
Doug Simons
50f447f5b8
Fix execute_xpath() to return an NSError when expression can't be evaluated; Remove previous attributes when setting attributes; Add related tests 2024-05-14 15:25:07 -06:00
rfm
adbc7c2631
Merge pull request #400 from gnustep/nsurlhandle_cache
GSFileURLHandle: Remove file handle caching
2024-05-12 10:11:28 +01:00
rfm
1fdf6395bd
Merge pull request #370 from ethanc8/ethanc8-3
Implement +[NSRegularExpression escapedPatternForString:] and -[NSString enumerateSubstringsInRange:options:usingBlock]
2024-05-12 09:32:34 +01:00
hmelder
c09bf52ef7 Format tests using clang-format 2024-05-08 16:06:44 +02:00
hmelder
e4a5e275de NSIndexSet: Add tests for enumerateRangesInRange 2024-05-08 16:06:44 +02:00
hmelder
a1dff584a4 GSFileURLHandle: Remove caching functionality 2024-05-06 18:06:50 +02:00
hmelder
e1fcc2db35 GSFileURLHandle: Use NSCache and limit cache size 2024-05-06 10:38:07 +02:00
Frederik Carlier
7ec9667505
Merge pull request #398 from qmfrederik/win64-hopeful
win64/clang+msvc: Skip failing tests and mark flaky test as hopeful
2024-04-29 17:35:29 +02:00
hmelder
3c3417fabe Remove Windows Include and correctly release thread obj 2024-04-28 23:22:20 +02:00
hmelder
80c3d66677 Add NSThread unit test for name: and setName: on win32 2024-04-28 23:22:20 +02:00
Frederik Carlier
6173861248
win64/clang+msvc: Skip failing tests and mark flaky test as hopeful 2024-04-28 22:16:45 +02:00
hmelder
2918bd992e Refactor +[NSTimeZone timeZoneArray] 2024-04-17 23:32:56 +02:00
rfm
509a29cc5b make stack symbols tests more ionformative ... check that class and method names are reported 2024-04-14 12:02:13 +01:00
rfm
6a796f145c temporary fix: revert ot using httpbin.org - a proper fix would be to use a local server controlled by the test process 2024-04-14 10:06:55 +01:00
rfm
9be55cc80a
Merge pull request #379 from svgol/refactor_NSURLConnection_tests
Refactor NSURLConnection tests
2024-04-04 13:39:07 +01:00