A new version of KernelTests was added to project The Inbox:
http://source.squeak.org/inbox/KernelTests-ct.383.mcz ==================== Summary ==================== Name: KernelTests-ct.383 Author: ct Time: 24 January 2021, 4:39:37.623504 pm UUID: 27645338-d085-9c45-ae2b-4263aade35b4 Ancestors: KernelTests-ct.382 Removes inappropriate test case for perform primitives with invalid number of arguments. Depends on KernelTests-ct.382. =============== Diff against KernelTests-ct.382 =============== Item was changed: SystemOrganization addCategory: #'KernelTests-Classes'! SystemOrganization addCategory: #'KernelTests-Methods'! SystemOrganization addCategory: #'KernelTests-Numbers'! SystemOrganization addCategory: #'KernelTests-Objects'! SystemOrganization addCategory: #'KernelTests-Processes'! + SystemOrganization addCategory: #'KernelTests-Models'! Item was added: + ----- Method: BlockClosureTest>>return: (in category 'private') ----- + return: something + + ^ something! Item was changed: ----- Method: BlockClosureTest>>testRunSimulated (in category 'tests') ----- testRunSimulated + self assert: Rectangle equals: + (Context runSimulated: aBlockClosure asContext) class. + self assert: 42 equals: + (Context runSimulated: [self return: 42]). + self + should: [Context runSimulated: [self halt]] + raise: Halt.! - self assert: Rectangle equals: (Context runSimulated: aBlockClosure asContext) class! Item was added: + ----- Method: BlockClosureTest>>testRunSimulatedContextAtEachStep (in category 'tests') ----- + testRunSimulatedContextAtEachStep + + | context | + context := aBlockClosure asContext. + self assert: Rectangle equals: (thisContext + runSimulated: context + contextAtEachStep: [:ctxt | self assert: + [ctxt == context or: [ctxt hasSender: context]]]) class.! Item was changed: ----- Method: ContextTest>>testPrimitive100 (in category 'tests') ----- testPrimitive100 { {#isNil. {}. Object}. "valid 0-arg message" {#=. {true}. UndefinedObject}. "valid unary message" {#ifNil:ifNotNil:. {[2]. [:x | x]}. Object}. "valid binary message" - {}. "missing selector" {#isNil}. "missing arguments" {#isNil. 'not an array'}. "invalid arguments" {#isNil. {}}. "missing lookupClass" {#isNil. {'excess arg'}. Object}. "too many arguments" {#=. {}. UndefinedObject}. "missing argument" {#isNil. {}. Boolean}. "lookupClass not in inheritance chain" } do: [:args | self assert: (Context runSimulated: [nil tryPrimitive: 100 withArgs: args]) equals: (nil tryPrimitive: 100 withArgs: args)].! Item was changed: ----- Method: ContextTest>>testPrimitive83 (in category 'tests') ----- testPrimitive83 { {#isNil}. "valid 0-arg message" {#=. true}. "valid unary message" {#ifNil:ifNotNil:. [2]. [:x | x]}. "valid binary message" - {}. "missing selector" {#isNil. 'excess arg'}. "too many arguments" {#=}. "missing argument" } do: [:args | self assert: (Context runSimulated: [nil tryPrimitive: 83 withArgs: args]) equals: (nil tryPrimitive: 83 withArgs: args)].! Item was changed: ----- Method: ContextTest>>testPrimitive84 (in category 'tests') ----- testPrimitive84 { {#isNil. {}}. "valid 0-arg message" {#=. {true}}. "valid unary message" {#ifNil:ifNotNil:. {[2]. [:x | x]}}. "valid binary message" - {}. "missing selector" {#isNil}. "missing arguments" {#isNil. 'not an array'}. "invalid arguments" {#isNil. {'excess arg'}}. "too many arguments" {#=. {}}. "missing argument" } do: [:args | self assert: (Context runSimulated: [nil tryPrimitive: 84 withArgs: args]) equals: (nil tryPrimitive: 84 withArgs: args)].! Item was added: + TestCase subclass: #ModelTest + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'KernelTests-Models'! Item was added: + ----- Method: ModelTest>>testCopyDependents (in category 'tests') ----- + testCopyDependents + + | bar foo | + foo := Model new. + foo addDependent: 42. + self assert: {42} equals: foo dependents asArray. + + bar := foo copy. + self assert: bar dependents isEmpty.! Item was added: + ----- Method: ObjectTest>>testCopyDependents (in category 'tests') ----- + testCopyDependents + + | bar foo | + foo := Object new. + foo addDependent: 42. + self assert: {42} equals: foo dependents asArray. + + bar := foo copy. + self assert: bar dependents isEmpty.! Item was added: + ----- Method: PromiseTest>>testNilErrBlockPropagation (in category 'tests - monad') ----- + testNilErrBlockPropagation + "https://promisesaplus.com section 2.2.7.4" + | p q | + p := Promise new. + q := p then: [:v | self error: 'Shouldn''t call resolvedBlock'] ifRejected: nil. + p rejectWith: 1. + self assert: p isRejected. + self assert: q isRejected. + self assert: p error equals: 1. + self assert: q error equals: 1.! Item was added: + ----- Method: PromiseTest>>testNilResolvedBlockPropagation (in category 'tests - monad') ----- + testNilResolvedBlockPropagation + "https://promisesaplus.com section 2.2.7.3" + | p q | + p := Promise new. + q := p then: nil ifRejected: [:e | self error: 'Shouldn''t call errBlock']. + p resolveWith: 1. + self assert: p isResolved. + self assert: q isResolved. + self assert: p value equals: 1. + self assert: q value equals: 1.! |
Free forum by Nabble | Edit this page |