--- a/CustomMockTests.st Thu Feb 05 22:42:42 2015 +0100
+++ b/CustomMockTests.st Thu Feb 05 22:50:23 2015 +0100
@@ -72,40 +72,6 @@
"Created: / 23-09-2014 / 22:53:52 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
!
-test_class_and_instance_methods_overriden_by_mock_block_value
- | class mockClass |
-
- self skipIf: true description: 'unable to fix'.
-
- [
- class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
- model createMethodImmediate: (class theMetaclass) protocol: 'p' source: 'aSelector_01: aParam
- ^ 10'.
- model createMethodImmediate: class protocol: 'p' source: 'aSelector_01: aParam
- ^ 15'.
-
- self assert: (class aSelector_01: nil) = 10.
- self assert: (class new aSelector_01: nil) = 15.
-
- mockClass := mock mockClassOf: class.
- mockClass mockSelector: #aSelector_01: withBlockValue: [ :aParam | ^ 20 ].
- mockClass new mockSelector: #aSelector_01: withBlockValue: [ :aParam | ^ 25 ].
-
- self assert: (mockClass aSelector_01: nil) = 20.
- self assert: (mockClass new aSelector_01: nil) = 25.
-
- testCompleted := true.
-
- ] ensure: [
- "Need to test if test is complete, because in this case
- sometimes happens that the test terminates and is marked as success."
- self assert: testCompleted
- ].
-
- "Created: / 10-07-2014 / 19:06:47 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
- "Modified: / 23-09-2014 / 23:21:26 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
test_class_methods_overriden_by_compiled_mock_method
| class mockClass |
@@ -171,41 +137,6 @@
"Modified (format): / 22-09-2014 / 23:14:13 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
!
-test_class_methods_overriden_by_mock_block_value
- | class mockClass |
-
- self skipIf: true description: 'unable to fix'.
-
- [
- class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
- model createMethodImmediate: (class theMetaclass) protocol: 'p' source: 'aSelector_01: aParam
- ^ 10'.
- model createMethodImmediate: (class theMetaclass) protocol: 'p' source: 'aSelector_02: aParam
-
- (self aSelector_01: aParam) = 10 ifTrue: [ ^ true ].
-
- ^ false'.
-
- self assert: (class aSelector_02: nil).
-
- mockClass := mock mockClassOf: class.
- mockClass mockSelector: #aSelector_01: withBlockValue: [ :aParam | ^ 20 ].
-
- self assert: (mockClass aSelector_01: nil) = 20.
- self assert: (mockClass aSelector_02: nil) not.
-
- testCompleted := true.
-
- ] ensure: [
- "Need to test if test is complete, because in this case
- sometimes happens that the test terminates and is marked as success."
- self assert: testCompleted
- ].
-
- "Created: / 10-07-2014 / 18:21:33 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
- "Modified: / 23-09-2014 / 23:21:57 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
test_create_mock_getters_for_selectors
| expectedSource01 actualSource01 expectedSource02 actualSource02 mockClass |
@@ -407,174 +338,6 @@
"Modified (format): / 22-09-2014 / 23:14:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
!
-test_methods_overriden_by_mock_block_value
- | class mockClassInstance |
-
- self skipIf: true description: 'unable to fix'.
-
- [
- class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
- model createMethodImmediate: class protocol: 'p' source: 'aSelector_01: aParam
- ^ 10'.
- model createMethodImmediate: class protocol: 'p' source: 'aSelector_02: aParam
-
- (self aSelector_01: aParam) = 10 ifTrue: [ ^ true ].
-
- ^ false'.
-
- self assert: (class new aSelector_02: nil).
-
- mockClassInstance := mock mockOf: class.
- mockClassInstance mockSelector: #aSelector_01: withBlockValue: [ :aParam | ^ 20 ].
-
- self assert: (mockClassInstance aSelector_01: nil) = 20.
- self assert: (mockClassInstance aSelector_02: nil) not.
-
-
- testCompleted := true.
-
- ] ensure: [
- "Need to test if test is complete, because in this case
- sometimes happens that the test terminates and is marked as success."
- self assert: testCompleted
- ].
-
- "Created: / 17-06-2014 / 21:48:00 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
- "Modified: / 23-09-2014 / 23:22:17 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-test_methods_overriden_by_mock_block_value_with_none_params
- | class mockClassInstance |
-
- self skipIf: true description: 'unable to fix'.
-
- [
- class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
- model createMethodImmediate: class protocol: 'p' source: 'aSelector_01
- ^ 10'.
-
- self assert: (class new aSelector_01 = 10).
-
- mockClassInstance := mock mockOf: class.
- mockClassInstance mockSelector: #aSelector_01 withBlockValue: [ ^ 30 ].
-
- self assert: (mockClassInstance aSelector_01) = 30.
-
- testCompleted := true.
-
- ] ensure: [
- "Need to test if test is complete, because in this case
- sometimes happens that the test terminates and is marked as success."
- self assert: testCompleted
- ].
-
- "Created: / 20-06-2014 / 09:02:04 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
- "Modified: / 23-09-2014 / 23:22:24 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-test_methods_overriden_by_mock_block_value_with_params
- | class mockClassInstance |
-
- self skipIf: true description: 'unable to fix'.
-
- [
- class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
- model createMethodImmediate: class protocol: 'p' source: 'aSelector_01: aParam
- ^ 10'.
- model createMethodImmediate: class protocol: 'p' source: 'aSelector_02: aParam
-
- (self aSelector_01: aParam) = 10 ifTrue: [ ^ true ].
-
- ^ false'.
-
- self assert: (class new aSelector_02: nil).
-
- mockClassInstance := mock mockOf: class.
- mockClassInstance mockSelector: #aSelector_01: withBlockValue: [ :aParam |
- aParam = 5 ifTrue: [
- ^ 10
- ].
-
- ^ 30
- ].
-
- self assert: (mockClassInstance aSelector_01: 5) = 10.
- self assert: (mockClassInstance aSelector_02: 3) not.
-
- testCompleted := true.
-
- ] ensure: [
- "Need to test if test is complete, because in this case
- sometimes happens that the test terminates and is marked as success."
- self assert: testCompleted
- ].
-
- "Created: / 17-06-2014 / 21:56:37 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
- "Modified: / 23-09-2014 / 23:22:28 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-test_methods_overriden_by_mock_block_value_with_three_params
- | class mockClassInstance |
-
- self skipIf: true description: 'unable to fix'.
-
- [
- class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
- model createMethodImmediate: class protocol: 'p' source: 'aSelector_01: arg_01 param_02: arg_02 param_03: arg_03
- ^ 10'.
-
- self assert: ((class new aSelector_01: 1 param_02: 2 param_03: 3) = 10).
-
- mockClassInstance := mock mockOf: class.
- mockClassInstance mockSelector: #aSelector_01:param_02:param_03: withBlockValue: [
- :arg_01 :arg_02 :arg_03 |
-
- ^ arg_01 + arg_02 + arg_03
- ].
-
- self assert: (mockClassInstance aSelector_01: 3 param_02: 3 param_03: 3) = 9.
-
- testCompleted := true.
-
- ] ensure: [
- "Need to test if test is complete, because in this case
- sometimes happens that the test terminates and is marked as success."
- self assert: testCompleted
- ].
-
- "Created: / 20-06-2014 / 09:22:54 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
- "Modified: / 23-09-2014 / 23:22:35 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
-test_methods_overriden_by_mock_block_value_with_two_params
- | class mockClassInstance |
-
- self skipIf: true description: 'unable to fix'.
-
- [
- class := model createClassImmediate: 'TestClassForMockTestCase' superClassName: 'Object'.
- model createMethodImmediate: class protocol: 'p' source: 'aSelector_01: arg_01 param_02: arg_02
- ^ 10'.
-
- self assert: ((class new aSelector_01: 1 param_02: 2) = 10).
-
- mockClassInstance := mock mockOf: class.
- mockClassInstance mockSelector: #aSelector_01:param_02: withBlockValue: [ :arg_01 :arg_02 | ^ arg_01 + arg_02 ].
-
- self assert: (mockClassInstance aSelector_01: 3 param_02: 3) = 6.
-
- testCompleted := true.
-
- ] ensure: [
- "Need to test if test is complete, because in this case
- sometimes happens that the test terminates and is marked as success."
- self assert: testCompleted
- ].
-
- "Created: / 20-06-2014 / 09:19:53 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
- "Modified: / 23-09-2014 / 23:22:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-!
-
test_mock_count_incremented_when_new_class_created
| class mockCount |