Christoph Thiede uploaded a new version of Tests to project The Trunk: http://source.squeak.org/trunk/Tests-ct.477.mcz
==================== Summary ====================
Name: Tests-ct.477 Author: ct Time: 31 January 2022, 8:42:26.054214 pm UUID: 1a7f2a13-c7f1-794d-a76a-6b107e74f42a Ancestors: Tests-ct.476
Complements SUnit-ct.130 (deprecation of TestResult error) and SUnit-ct.138 (new convenience #shouldRaiseError:).
=============== Diff against Tests-ct.476 ===============
Item was changed: ----- Method: PrimCallControllerAbstractTest>>testChangeFailedCallFailing (in category 'tests') ----- testChangeFailedCallFailing pcc preserveStatusOfFailedCalls. + self shouldRaiseError: [pcc enableCallIn: self failedCallRef]. + self shouldRaiseError: [pcc disableCallIn: self failedCallRef].! - self - should: [pcc enableCallIn: self failedCallRef] - raise: TestResult error. - self - should: [pcc disableCallIn: self failedCallRef] - raise: TestResult error!
Item was changed: ----- Method: PrimCallControllerAbstractTest>>testDisableCallsIntoModule (in category 'tests') ----- testDisableCallsIntoModule "wrong module" + self shouldRaiseError: [pcc disableCallsIntoModule: 'totallyRandom4711']. - self - should: [pcc disableCallsIntoModule: 'totallyRandom4711'] - raise: TestResult error. "precondition: all enabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "disabling" pcc disableCallsIntoModule: self exampleModuleName. "now all disabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = 0. "not enabled!!" + self shouldRaiseError: [pcc disableCallsIntoModule: self exampleModuleName]. - self - should: [pcc disableCallsIntoModule: self exampleModuleName] - raise: TestResult error. "enabling" self methodRefsToExampleModule do: [:ref | pcc enableCallIn: ref]. "all enabled now" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "not enabled!!" + self shouldRaiseError: [pcc disableCallsIntoModule: self failModuleName]. - self - should: [pcc disableCallsIntoModule: self failModuleName] - raise: TestResult error. pcc changeStatusOfFailedCalls. pcc disableCallsIntoModule: self failModuleName. self assert: (pcc existsDisabledCallIn: self failedCallRef). "postcondition" + pcc enableCallIn: self failedCallRef.! - pcc enableCallIn: self failedCallRef - !
Item was changed: ----- Method: PrimCallControllerAbstractTest>>testDisableCallsIntoModuleForClasses (in category 'tests') ----- testDisableCallsIntoModuleForClasses "wrong module" + self shouldRaiseError: [pcc disableCallsIntoModule: 'totallyRandom4711' forClasses: {self class}]. - self - should: [pcc disableCallsIntoModule: 'totallyRandom4711' forClasses: {self class}] - raise: TestResult error. "precondition: all enabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "disabling" pcc disableCallsIntoModule: self exampleModuleName forClasses: {self class}. "now all disabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = 0. "not enabled!!" + self shouldRaiseError: [pcc disableCallsIntoModule: self exampleModuleName forClasses: {self class}]. - self - should: [pcc disableCallsIntoModule: self exampleModuleName forClasses: {self class}] - raise: TestResult error. "enabling" self methodRefsToExampleModule do: [:ref | pcc enableCallIn: ref]. "all enabled now" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "not enabled!!" + self shouldRaiseError: [pcc disableCallsIntoModule: self failModuleName forClasses: {self class}]. - self - should: [pcc disableCallsIntoModule: self failModuleName forClasses: {self class}] - raise: TestResult error. pcc changeStatusOfFailedCalls. pcc disableCallsIntoModule: self failModuleName forClasses: {self class}. self assert: (pcc existsDisabledCallIn: self failedCallRef). "postcondition" + pcc enableCallIn: self failedCallRef.! - pcc enableCallIn: self failedCallRef - !
Item was changed: ----- Method: PrimCallControllerAbstractTest>>testEnableCallsIntoModule (in category 'tests') ----- testEnableCallsIntoModule self avoidSlowTest ifTrue: [^ self]. "wrong module" + self shouldRaiseError: [pcc enableCallsIntoModule: 'totallyRandom4711']. - self - should: [pcc enableCallsIntoModule: 'totallyRandom4711'] - raise: TestResult error. "precondition: all enabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "not disabled!!" + self shouldRaiseError: [pcc enableCallsIntoModule: self exampleModuleName]. - self - should: [pcc enableCallsIntoModule: self exampleModuleName] - raise: TestResult error. "disabling" self methodRefsToExampleModule do: [:ref | pcc disableCallIn: ref]. "now all disabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = 0. "enabling" "now this should work" pcc enableCallsIntoModule: self exampleModuleName. "all enabled now" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "not disabled!!" + self shouldRaiseError: [pcc enableCallsIntoModule: self failModuleName]. - self - should: [pcc enableCallsIntoModule: self failModuleName] - raise: TestResult error. pcc changeStatusOfFailedCalls. pcc enableCallsIntoModule: self failModuleName. + self assert: (pcc existsEnabledCallIn: self failedCallRef).! - self assert: (pcc existsEnabledCallIn: self failedCallRef) - !
Item was changed: ----- Method: PrimCallControllerAbstractTest>>testEnableCallsIntoModuleForClasses (in category 'tests') ----- testEnableCallsIntoModuleForClasses "wrong module" + self shouldRaiseError: [pcc enableCallsIntoModule: 'totallyRandom4711' forClasses: {self class}]. - self - should: [pcc enableCallsIntoModule: 'totallyRandom4711' forClasses: {self class}] - raise: TestResult error. "precondition: all enabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "not disabled!!" + self shouldRaiseError: [pcc enableCallsIntoModule: self exampleModuleName forClasses: {self class}]. - self - should: [pcc enableCallsIntoModule: self exampleModuleName forClasses: {self class}] - raise: TestResult error. "disabling" self methodRefsToExampleModule do: [:ref | pcc disableCallIn: ref]. "now all disabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = 0. "enabling" "now this should work" pcc enableCallsIntoModule: self exampleModuleName forClasses: {self class}. "all enabled now" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "not disabled!!" + self shouldRaiseError: [pcc enableCallsIntoModule: self failModuleName forClasses: {self class}]. - self - should: [pcc enableCallsIntoModule: self failModuleName forClasses: {self class}] - raise: TestResult error. pcc changeStatusOfFailedCalls. pcc enableCallsIntoModule: self failModuleName forClasses: {self class}. + self assert: (pcc existsEnabledCallIn: self failedCallRef).! - self assert: (pcc existsEnabledCallIn: self failedCallRef) - !
Item was changed: ----- Method: PrimCallControllerAbstractTest>>testEnableDisableCallIn (in category 'tests') ----- testEnableDisableCallIn | refs | refs := self methodRefsToExampleModule. "wrong call" + self shouldRaiseError: [pcc disableCallIn: self wrongCallRef]. - self - should: [pcc disableCallIn: self wrongCallRef] - raise: TestResult error. "wrong class" + self shouldRaiseError: [pcc disableCallIn: self wrongClassRef]. - self - should: [pcc disableCallIn: self wrongClassRef] - raise: TestResult error. "wrong call" + self shouldRaiseError: [pcc enableCallIn: self wrongCallRef]. - self - should: [pcc enableCallIn: self wrongCallRef] - raise: TestResult error. "wrong class" + self shouldRaiseError: [pcc enableCallIn: self wrongClassRef]. - self - should: [pcc enableCallIn: self wrongClassRef] - raise: TestResult error. "no external call" + self shouldRaiseError: [pcc enableCallIn: self noExternalCallRef]. - self - should: [pcc enableCallIn: self noExternalCallRef] - raise: TestResult error. "precondition: all enabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "not disabled!!" + self shouldRaiseError: [refs + do: [:ref1 | pcc enableCallIn: ref1]]. - self - should: [refs - do: [:ref1 | pcc enableCallIn: ref1]] - raise: TestResult error. "disabling" refs do: [:ref2 | pcc disableCallIn: ref2]. "now all disabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = 0. "not enabled!!" + self shouldRaiseError: [refs + do: [:ref3 | pcc disableCallIn: ref3]]. - self - should: [refs - do: [:ref3 | pcc disableCallIn: ref3]] - raise: TestResult error. "enabling" "now this should work" refs do: [:ref4 | pcc enableCallIn: ref4]. "all enabled now" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "try caches" pcc disableEnabled. "all disabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = 0. pcc enableDisabled. "all enabled" + self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule.! - self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule!
Item was changed: ----- Method: PrimCallControllerAbstractTest>>testEnableDisableCallInCompiledMethod (in category 'tests') ----- testEnableDisableCallInCompiledMethod "Note: >>compiledMethodsToExampleModule has to be called frequently, since the CMs are changing with a successful compile!!" "precondition: all enabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "not disabled!!" + self shouldRaiseError: [self compiledMethodsToExampleModule + do: [:cm1 | pcc enableCallInCompiledMethod: cm1]]. - self - should: [self compiledMethodsToExampleModule - do: [:cm1 | pcc enableCallInCompiledMethod: cm1]] - raise: TestResult error. "disabling" self compiledMethodsToExampleModule do: [:cm2 | pcc disableCallInCompiledMethod: cm2]. "now all disabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = 0. "not enabled!!" + self shouldRaiseError: [self compiledMethodsToExampleModule + do: [:cm3 | pcc disableCallInCompiledMethod: cm3]]. - self - should: [self compiledMethodsToExampleModule - do: [:cm3 | pcc disableCallInCompiledMethod: cm3]] - raise: TestResult error. "enabling" "now this should work" self compiledMethodsToExampleModule do: [:cm4 | pcc enableCallInCompiledMethod: cm4]. self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "try caches" pcc disableEnabled. "all disabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = 0. pcc enableDisabled. "all enabled" + self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule.! - self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule!
Item was changed: ----- Method: PrimCallControllerAbstractTest>>testEnableDisableCallInMethodClass (in category 'tests') ----- testEnableDisableCallInMethodClass | sels | sels := self methodSelectorsToExampleModule. "wrong call" + self shouldRaiseError: [pcc disableCallInMethod: #nonExistingCall class: self class]. - self - should: [pcc disableCallInMethod: #nonExistingCall class: self class] - raise: TestResult error. "wrong class" + self shouldRaiseError: [pcc disableCallInMethod: sels first class: Integer]. - self - should: [pcc disableCallInMethod: sels first class: Integer] - raise: TestResult error. "wrong call" + self shouldRaiseError: [pcc enableCallInMethod: #nonExistingCall class: self class]. - self - should: [pcc enableCallInMethod: #nonExistingCall class: self class] - raise: TestResult error. "wrong class" + self shouldRaiseError: [pcc enableCallInMethod: sels first class: Integer]. + self shouldRaiseError: [pcc enableCallInMethod: self noExternalCallSelector class: self class]. - self - should: [pcc enableCallInMethod: sels first class: Integer] - raise: TestResult error. - self - should: [pcc enableCallInMethod: self noExternalCallSelector class: self class] - raise: TestResult error. "precondition: all enabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "not disabled!!" + self shouldRaiseError: [sels + do: [:sel1 | pcc enableCallInMethod: sel1 class: self class]]. - self - should: [sels - do: [:sel1 | pcc enableCallInMethod: sel1 class: self class]] - raise: TestResult error. "disabling" sels do: [:sel2 | pcc disableCallInMethod: sel2 class: self class]. "now all disabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = 0. "not enabled!!" + self shouldRaiseError: [sels + do: [:sel3 | pcc disableCallInMethod: sel3 class: self class]]. - self - should: [sels - do: [:sel3 | pcc disableCallInMethod: sel3 class: self class]] - raise: TestResult error. "enabling" "now this should work" sels do: [:sel4 | pcc enableCallInMethod: sel4 class: self class]. "all enabled now" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule. "try caches" pcc disableEnabled. "all disabled" self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = 0. pcc enableDisabled. "all enabled" + self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule.! - self assert: (pcc methodsWithEnabledCallIntoModule: self exampleModuleName forClass: self class) size = self numOfCallsExampleModule!
Item was changed: ----- Method: PrimCallControllerAbstractTest>>testSwitchPrimCallOffOn (in category 'tests') ----- testSwitchPrimCallOffOn | res | pcc disableCallInMethod: self realExternalCallOrPrimitiveFailedSelector class: self class. + self shouldRaiseError: [self perform: self realExternalCallOrPrimitiveFailedSelector]. - self - should: [self perform: self realExternalCallOrPrimitiveFailedSelector] - raise: TestResult error. pcc enableCallInMethod: self realExternalCallOrPrimitiveFailedSelector class: self class. res := self perform: self realExternalCallOrPrimitiveFailedSelector. + self assert: res isString.! - self assert: res isString!
packages@lists.squeakfoundation.org