Levente Uzonyi uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-ul.366.mcz ==================== Summary ==================== Name: KernelTests-ul.366 Author: ul Time: 19 June 2019, 5:13:59.180093 pm UUID: 1c49d964-f547-4e48-9a9d-317818c6c7d1 Ancestors: KernelTests-mt.365 - added tests for Object >> #perform:* and BlockClosure >> #value* =============== Diff against KernelTests-mt.365 =============== Item was added: + ----- Method: BlockClosureTest>>testValue (in category 'tests - evaluating') ----- + testValue + + "#value" + self + assert: nil equals: [ ] value; + assert: 1 equals: [ 1 ] value; + should: [ [ :a | ] value ] raise: Error. + + "#value:" + self + assert: nil equals: ([ :a | ] value: 1); + assert: 1 equals: ([ :a | a ] value: 1); + should: [ [ ] value: 1 ] raise: Error; + should: [ [ :a :b | ] value: 1 ] raise: Error! Item was added: + ----- Method: BlockClosureTest>>testValueValue (in category 'tests - evaluating') ----- + testValueValue + + self + assert: nil equals: ([ :a :b | ] value: 1 value: 2); + assert: 1 equals: ([ :a :b | a ] value: 1 value: 2); + assert: 2 equals: ([ :a :b | b ] value: 1 value: 2); + should: [ [ ] value: 1 value: 2 ] raise: Error; + should: [ [ :a | ] value: 1 value: 2 ] raise: Error; + should: [ [ :a :b :c | ] value: 1 value: 2 ] raise: Error! Item was added: + ----- Method: BlockClosureTest>>testValueValueValue (in category 'tests - evaluating') ----- + testValueValueValue + + self + assert: nil equals: ([ :a :b :c | ] value: 1 value: 2 value: 3); + assert: 1 equals: ([ :a :b :c | a ] value: 1 value: 2 value: 3); + assert: 2 equals: ([ :a :b :c | b ] value: 1 value: 2 value: 3); + assert: 3 equals: ([ :a :b :c | c ] value: 1 value: 2 value: 3); + should: [ [ ] value: 1 value: 2 value: 3 ] raise: Error; + should: [ [ :a | ] value: 1 value: 2 value: 3 ] raise: Error; + should: [ [ :a :b | ] value: 1 value: 2 value: 3 ] raise: Error; + should: [ [ :a :b :c :d | ] value: 1 value: 2 value: 3 ] raise: Error! Item was added: + ----- Method: BlockClosureTest>>testValueValueValueValue (in category 'tests - evaluating') ----- + testValueValueValueValue + + self + assert: nil equals: ([ :a :b :c :d | ] value: 1 value: 2 value: 3 value: 4); + assert: 1 equals: ([ :a :b :c :d | a ] value: 1 value: 2 value: 3 value: 4); + assert: 2 equals: ([ :a :b :c :d | b ] value: 1 value: 2 value: 3 value: 4); + assert: 3 equals: ([ :a :b :c :d | c ] value: 1 value: 2 value: 3 value: 4); + assert: 4 equals: ([ :a :b :c :d | d ] value: 1 value: 2 value: 3 value: 4); + should: [ [ ] value: 1 value: 2 value: 3 value: 4 ] raise: Error; + should: [ [ :a | ] value: 1 value: 2 value: 3 value: 4 ] raise: Error; + should: [ [ :a :b | ] value: 1 value: 2 value: 3 value: 4 ] raise: Error; + should: [ [ :a :b :c | ] value: 1 value: 2 value: 3 value: 4 ] raise: Error; + should: [ [ :a :b :c :d :e | ] value: 1 value: 2 value: 3 value: 4 ] raise: Error! Item was added: + ----- Method: BlockClosureTest>>testValueValueValueValueValue (in category 'tests - evaluating') ----- + testValueValueValueValueValue + + self + assert: nil equals: ([ :a :b :c :d :e | ] value: 1 value: 2 value: 3 value: 4 value: 5); + assert: 1 equals: ([ :a :b :c :d :e | a ] value: 1 value: 2 value: 3 value: 4 value: 5); + assert: 2 equals: ([ :a :b :c :d :e | b ] value: 1 value: 2 value: 3 value: 4 value: 5); + assert: 3 equals: ([ :a :b :c :d :e | c ] value: 1 value: 2 value: 3 value: 4 value: 5); + assert: 4 equals: ([ :a :b :c :d :e | d ] value: 1 value: 2 value: 3 value: 4 value: 5); + assert: 5 equals: ([ :a :b :c :d :e | e ] value: 1 value: 2 value: 3 value: 4 value: 5); + should: [ [ ] value: 1 value: 2 value: 3 value: 4 value: 5 ] raise: Error; + should: [ [ :a | ] value: 1 value: 2 value: 3 value: 4 value: 5 ] raise: Error; + should: [ [ :a :b | ] value: 1 value: 2 value: 3 value: 4 value: 5 ] raise: Error; + should: [ [ :a :b :c | ] value: 1 value: 2 value: 3 value: 4 value: 5 ] raise: Error; + should: [ [ :a :b :c :d | ] value: 1 value: 2 value: 3 value: 4 value: 5 ] raise: Error; + should: [ [ :a :b :c :d :e :f | ] value: 1 value: 2 value: 3 value: 4 value: 5 ] raise: Error! Item was added: + ----- Method: ObjectTest>>testPerform (in category 'tests') ----- + testPerform + + | object | + object := Object new. + self assert: object equals: (object perform: #yourself). + self deny: 1 equals: (object perform: #yourself). + self assert: 4 equals: (2 perform: #squared). + self deny: 3 equals: (2 perform: #squared)! Item was added: + ----- Method: ObjectTest>>testPerformWith (in category 'tests') ----- + testPerformWith + + self assert: 7 equals: (3 perform: #+ with: 4)! Item was added: + ----- Method: ObjectTest>>testPerformWithWith (in category 'tests') ----- + testPerformWithWith + + | receiver | + receiver := [ :a :b | { a. b } ]. + self assert: #(1 2) equals: (receiver perform: #value:value: with: 1 with: 2)! Item was added: + ----- Method: ObjectTest>>testPerformWithWithWith (in category 'tests') ----- + testPerformWithWithWith + + | receiver | + receiver := [ :a :b :c | { a. b. c } ]. + self assert: #(1 2 3) equals: (receiver perform: #value:value:value: with: 1 with: 2 with: 3)! Item was added: + ----- Method: ObjectTest>>testPerformWithWithWithWith (in category 'tests') ----- + testPerformWithWithWithWith + + | receiver | + receiver := [ :a :b :c :d | { a. b. c. d } ]. + self assert: #(1 2 3 4) equals: (receiver perform: #value:value:value:value: with: 1 with: 2 with: 3 with: 4)! Item was added: + ----- Method: ObjectTest>>testPerformWithWithWithWithWith (in category 'tests') ----- + testPerformWithWithWithWithWith + + | receiver | + receiver := [ :a :b :c :d :e | { a. b. c. d. e } ]. + self assert: #(1 2 3 4 5) equals: (receiver perform: #value:value:value:value:value: with: 1 with: 2 with: 3 with: 4 with: 5)! |
Free forum by Nabble | Edit this page |