Commit Graph
470 Commits
Author SHA1 Message Date
Martin Carlberg 9e6f1e0dc3 Fixed: Timezone abbreviation was not working with the latest changes on all setups.
This is still not 100% but looks like it works a little bit better
2021-09-21 15:38:51 +02:00
Martin Carlberg 9f14dac5d2 Fixed: Cleanup of the output from our test cases 2021-09-21 11:11:25 +02:00
Martin Carlberg 6b1cdbd19c Fixed: Removed compiler warnings from test cases 2021-09-21 10:58:03 +02:00
Martin Carlberg 6c49116c68 Fixed: Use date string that is not as old as the previous one.
JavaScript now handles time a lot better. Times from before around 1900 is different in different
parts of the world so we just changed this test case to be a bit more modern.
2021-09-21 10:55:16 +02:00
Martin Carlberg 68f0cf27df Fixed: Bundle test cases must run asynchronous as a bundle will also load asynchronous in Node.
Also removed some compilation warnings from the test cases.
2021-09-21 10:51:17 +02:00
Martin Carlberg 24bf09b70c Fixed: Abbreviation for a timezone is not handled in JavaScript. This changes makes it better but not perfect. 2021-09-21 10:30:26 +02:00
Martin Carlberg a835202db1 Fixed: Adjusted test cases for Node. XMLHttpRequest now demands a protocol. 2021-09-20 11:00:37 +02:00
Martin Carlberg a893f3f5c1 Fixed: The tool ojtest now works with the new Node version. 2021-09-03 14:31:11 +02:00
daboe01 9c95c9c6e9 formatting 2020-07-13 20:37:52 +02:00
daboe01 4b052e74f1 test whether range restriction works 2020-07-05 16:06:04 +02:00
daboe01 bd6b8e4b7f fixed: comparison between wrong objects 2020-07-03 21:27:48 +02:00
daboe01 26e8432bb0 debugging 2020-07-03 19:55:51 +02:00
daboe01 05f9fd22fe formatting 2020-07-03 19:36:06 +02:00
daboe01 8f5bde2797 new: unittest for replaceOccurrencesOfString:withString:options:range: 2020-07-02 19:38:34 +02:00
Martin Carlberg f5937a6fad Fixed: CPComparisonPredicate does never evaluate to true for a predicate like 'something != nil'
An example:

var array = @[ @{@"Name": @"1"},
               @{@"Name": @"2", @"approveTime": @"Now"}
             ];

var predicate = [CPPredicate predicateWithFormat:@"approveTime != nil"];

CPLog(@"result: %@", [array filteredArrayUsingPredicate:predicate]); // result: <empty array>

If I run this in Cappuccino I get an empty array

If I run it in Cocoa on a Mac I get:

result: (
        {
        Name = 2;
        approveTime = Now;
    }
2020-01-31 14:24:29 +01:00
Martin Carlberg dad49354aa Fixed: CPSet enumerateObjectsUsingBlock: will honor the stop variable
Test case also added.

Deprecated the very old behaviour that the block could return YES to abort the enumeration.
2019-10-18 13:01:04 +02:00
daboe01andMartin Carlberg 7bd8bf02f6 Fixed: Typo in function call to _CPDecimalSetZero and made the test case work properly (#2820) 2019-06-13 16:09:17 +02:00
cacaodev 5da8728d6c New: CPObject instancesImplementSelector:(SEL)aSelector
Tests if instances of given class implement a selector.

With test.

Note: The naming is from cocoa where this method is semi-public.
2016-11-12 18:30:02 +01:00
Martin Carlbergandcacaodev ae5d31746e Dependent key paths use a relationship (#2431)
Fixed: When dependent key paths use a relationship, only the first added observer will observe the attribute for the relationship object.

Also, an optimisation on when the willChange… chain is running, there is no need to replace the observers as no new values are set yet. That will be done when the didChange… chain is running.
2016-05-09 22:14:20 +02:00
Alexander Ljungberg e13f5ed730 Fixed: CPNumber intValue did not return an integer.
We expect this method to return a whole number like in Objective-C. This also goes for the related methods, `shortValue`, `longValue` and `longLongValue`.

Also adds more tests (in addition to the existing, already failing test).
2016-04-01 22:22:03 +01:00
Martin Carlberg c1ec27045c Fixed: Rhino does not support numbers starting with ’0’ 2016-03-23 09:35:19 +01:00
Martin Carlberg 111b12161c Added: test cases for ’intValue’ and ’integerValue’ methods on CPString and CPNumber 2016-03-23 09:02:09 +01:00
cacaodev 6b683bd02d Merge pull request #2402 from cacaodev/CPExpression-constructors
NEW : CPExpression +expressionForBlock:arguments:
                                   +expressionForConditional:trueExpression:falseExpression:
2016-01-25 10:22:18 +01:00
cacaodev e172217427 Merge pull request #2404 from cacaodev/CPArray-mapUsingBlock
New: CPArray -arrayByApplyingBlock:
2016-01-16 19:25:07 +01:00
Antoine Mercadal 5d88d07edc FIXED: CPPredicate's predicateFormat with a CPNull value as right expression wasn't working
Previously a CPPredicate created with format `value == nil` was converted back to `value == <CPNull @ xxxx>`

This patch ensures `predicateFormat` returns `value == nil`

Test added in CPPredicateTest.j
2016-01-14 15:50:24 -08:00
cacaodev 08aa591c65 NEW CPArray -arrayByApplyingBlock:(Function/*element, index*/)aBlock
Test for CPArray -arrayByApplyingBlock:
2016-01-14 21:57:57 +01:00
cacaodev 07b6e2b9f1 CPExpression +expressionForConditional:trueExpression:falseExpression:
Conditional Expression : an expression using different expressions for
evaluation, depending of a predicate result.

Support for predicate parsing: ```TERNARY(predicate, trueExpression,
falseExpression)```

With init, equal, evaluation, parsing tests.
2015-12-27 15:45:03 +01:00
cacaodev 5ab10f4024 NEW: CPExpression +expressionForBlock:arguments:
An expression that returns the result of evaluating a block.

With tests.
2015-12-27 15:44:36 +01:00
cacaodev 0ac08456bc Merge pull request #2401 from cacaodev/CPSubqueryExpression
FIXED: Subquery expressions were ignoring evaluation context
2015-12-26 00:12:13 +01:00
cacaodev 80a3549ef5 FIXED: Subquery expressions were ignoring evaluation context
When the predicate part of a subquery expression was containing
variables, the substitution was ignored.
Now, the subpredicate can contain variables that will be substituted
when calling evaluateWithObject:substitutionVariables:.

Added expression test and predicate parsing test.
2015-12-23 18:49:07 +01:00
Alexandre Wilhelm b59b0259ca Fixed: CPDateFormatter did not work with symbols MM and LL with the month of december 2015-12-09 10:51:51 -08:00
Martin Carlberg 758ad3eb06 Fixed: Method types was not copied into new KVO implementation of a class that is observed with KVO.
Some test cases are also added for this.
2015-11-20 12:43:53 +01:00
Antoine Mercadal d5f38fe2f2 Merge pull request #2392 from Dogild/RunLoopBlock
New: added the method performBlock in CPRunLoop
2015-10-27 17:36:22 -07:00
Alexandre Wilhelm b04e5760fb Test: added unittest for method stringByReplacingCharactersInRange of CPString 2015-10-27 12:06:47 -07:00
Alexandre Wilhelm 4d1dc0c949 New: added the method performBlock in CPRunLoop
Previously, we could only give a selector and a target for perform in the runLoop. Now we can give a block.
This feature is used in the CPTextField class. Previously, when we wanted to call a function at the end of the stack we used window.setTimeout, however due to HTML5 specifications this wasn't called just at the end of the stack but at least 4ms (more information here https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout#Minimum_delay_and_timeout_nesting). Now we give a block to perform, and this block will be performed in the next runloop.

Unittest has been added in Tests/Foundation/CPRunLoopTest.j
2015-10-26 15:36:13 -07:00
Alexandre Wilhelm 22b77af9d3 New: added the class CPNotificationQueue
This PR adds the feature of CPNotificationQueue.

Cappuccino provides a framework for sending messages between objects within
a process called notifications. CPNotificationQueue objects (or simply notification queues)
act as buffers for notification centers (instances of CPNotificationCenter).
Whereas a notification center distributes notifications when posted,
notifications placed into the queue can be delayed until the end of the current pass through the run loop
or until the run loop is idle. Duplicate notifications can also be coalesced so that only one notification
is sent although multiple notifications are posted. A notification queue maintains notifications
(instances of C¨Notification) generally in a first in first out (FIFO) order.
When a notification rises to the front of the queue, the queue posts it to the notification center,
which in turn dispatches the notification to all objects registered as observers.

More informations here :https://developer.apple.com/library/prerelease/ios/documentation/Cocoa/Reference/Foundation/Classes/NSNotificationQueue_Class/index.html#//apple_ref/occ/instm/NSNotificationQueue/enqueueNotification:postingStyle:coalesceMask:forModes:

Unit-Tests in Tests/Foundation/CPNotificationQueueTest.j
2015-10-08 16:06:16 -07:00
Alexandre Wilhelm 3e29732e46 Fixed: OperationQueue for the CPNotificationCenter is not ignored anymore
Previously, the operationQueue given to the notificationCenter was ignored.

Tests in CPNotificationCenterTest.j
2015-10-08 11:23:07 -07:00
Alexandre Wilhelm 686f931fb4 Merge pull request #2343 from Dogild/Localization
New: first work on localization
2015-10-02 11:04:35 -07:00
Martin Carlberg 1b0d053ab9 Fixed: Check the abbreviation from the correct place in the test 2015-09-30 18:15:32 +02:00
Martin Carlberg 5871c4f092 Fixed: Fixed test cases where CPTimeZone does not handle daylight saving time.
For example the method ’initWithName:’ will return different abbreviation depending on the order CPDictionary returns keys from the method ’keyEnumerator’. As this is undefined the answer can vary. Test cases now handle all cases.
2015-09-30 17:03:36 +02:00
Martin Carlberg 3a7384ec26 Fixed: CPDictionary initWithObjectsAndKeys was not compliant with Cocoa or the init method ’initWithObjects:forKeys:’ when duplicated keys was passed to the method.
Test cases are also added
2015-09-30 16:59:04 +02:00
Martin Carlberg 8599ad4a3c Fixed: The init method ’initWithObjects:count:’ for CPArray did not work on native CPJavaScriptArray when ’count’ is not the same as the length on the provided array.
A test case for this is also added in the test class CPArrayTest
2015-09-25 17:07:15 +02:00
Alexandre Wilhelm bb9408b5d0 Merge branch 'master' into Localization 2015-08-27 15:16:12 -07:00
Malte Tancred 26bb54472f Fixed: preserve type of boolean values when parsing CPPredicate format
When parsing a predicate format that contains a constant boolean expression
(e.g., 'key = YES') the value of the returned constant value expression has
the wrong type. Instead of using native types as values, the parser uses
[CPNumber +numberWithBool:].

This commit changes the format parser (CPPredicateScanner) to use native
booleans for constant value expression.

There's a test case that checks the parse result and an additional test
that ensures boolean expressions evaluate as expected with different kinds
of objects. The latter test passed before the fix but was added to ensure
compliance with Cocoa.
2015-08-12 17:05:56 +02:00
Alexandre Wilhelm 66b1d297ba Test: added unit test CPBundleTest 2015-04-22 15:11:47 -07:00
Antoine Mercadal 007ca4c6b0 Merge pull request #2336 from cpasslack/cpasslack/corruptDecimalNumberAfterDecodingFix
Fixed: Encoding a [CPDecimalNumber zero] causes a corrupt CPDecimalNumbe...
2015-03-31 11:25:20 -07:00
Alexander Ljungberg 1925b7b324 Merge branch 'refs/heads/0.9.8' 2015-03-29 13:39:28 +01:00
Alexander Ljungberg d39bcfb7bd Tests: new nil exception test for CPDictionary. 2015-03-29 13:16:51 +01:00
Christian Passlack bb9049bef4 Code-styling to match official style-guide. 2015-03-23 20:45:31 +01:00
Christian Passlack 94f15aba40 Updated Test-Cases of CPNumberFormater and CPTextfield because of the
changes for fix #2332. The test-cased failed, because now a
a CPDecimalNumber has a different UID compared to a CPNumber with the same
value. That means isEqual: will return false. In the test-cases the formatter now
generates CPNumbers to make the two Numbers compareable via isEqual.
2015-03-23 20:30:01 +01:00