-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Ennio <ennio.strohauer@student.hpi.de>
- Loading branch information
Showing
20 changed files
with
67 additions
and
31 deletions.
There are no files selected for viewing
11 changes: 10 additions & 1 deletion
11
src/Koans-Chapters.package/KoanAboutBlocks.class/instance/test03theLastStatementReturns.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
tests | ||
test03theLastStatementReturns | ||
"This is part of the buggy way of the art of Smalltalk. | ||
The value of the last statement of a block is returned. | ||
Always the last!" | ||
|
||
| processing | | ||
|
||
self assert: xx equals: [123 . 456 . 789] value. | ||
self assert: xx equals: ['first' . 'second'] value | ||
self assert: xx equals: ['first' . 'second'] value. | ||
|
||
processing := [:a :b | a. b]. | ||
self assert: xx equals: (processing value: true value: false). | ||
self assert: xx equals: (processing value: false value: true) |
2 changes: 2 additions & 0 deletions
2
...ers.package/KoanAboutBlocks.class/instance/test05passParametersToBlocksButPassTheRight.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ass/instance/test08blocksAndConditions.st → ...ass/instance/test07blocksAndConditions.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
src/Koans-Chapters.package/KoanAboutBlocks.class/instance/test07rememberTheFinalStatement.st
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/Koans-Chapters.package/KoanAboutClasses.class/class/koan05whoIAmTellsYouClassSuccess.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
as yet unclassified | ||
koan05whoIAmTellsYouClassSuccess | ||
|
||
^ 'Success! Remember to only use meta programming if absolutely required for the situation.' |
4 changes: 4 additions & 0 deletions
4
...pters.package/KoanAboutClasses.class/class/koan06classesUnderstandCanUnderstandSuccess.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
as yet unclassified | ||
koan06classesUnderstandCanUnderstandSuccess | ||
|
||
^ 'Success! Remember to only use meta programming if absolutely required for the situation.' |
15 changes: 9 additions & 6 deletions
15
...hapters.package/KoanAboutClasses.class/instance/test02instanceVariablesAreEncapsulated.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
tests | ||
test02instanceVariablesAreEncapsulated | ||
"First take a look at the KoanLotus class using the Browse Project button. | ||
"First take a look at the KoanLotus class using the 'browse' button. | ||
(You may also select 'KoanLotus' and click browse it) | ||
It has two instance variables: privateInstanceVariable and publicInstanceVariable. | ||
Also look at the methods of the Lotus. Now what will happen down below?" | ||
Also look at the methods of the Lotus. Now what will happen down below? | ||
Hint: | ||
should:raise: executes the code in braces and looks for an exception specified after raise:. | ||
You can find the name of the exception class in the title of the debugger window above." | ||
|
||
| aLotus | | ||
aLotus := KoanLotus new. | ||
self should: [aLotus privateInstanceVariable] raise: xx | ||
|
||
"should:raise: executes the code in braces and looks for an exception specified after raise:. | ||
You can find the name of the exception class in the title of the debugger window." | ||
self should: [aLotus privateInstanceVariable] raise: xx |
4 changes: 4 additions & 0 deletions
4
...-Chapters.package/KoanAboutClasses.class/instance/test06classesUnderstandCanUnderstand.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
src/Koans-Chapters.package/KoanAboutClasses.class/methodProperties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
{ | ||
"class" : { | ||
"koan05whoIAmTellsYouClassSuccess" : "ek 6/14/2023 11:14", | ||
"koan06classesUnderstandCanUnderstandSuccess" : "ek 6/14/2023 11:14", | ||
"priority" : "rhi 10/12/2017 11:44", | ||
"requiredClasses" : "rhi 10/12/2017 11:44", | ||
"requirements" : "JE 6/8/2017 15:19" }, | ||
"instance" : { | ||
"test01createAnInstanceWithNew" : "rhi 10/12/2017 09:11", | ||
"test02instanceVariablesAreEncapsulated" : "rhi 10/12/2017 09:25", | ||
"test02instanceVariablesAreEncapsulated" : "ek 6/14/2023 11:00", | ||
"test03theTaleOfNewAndBasicNew" : "rhi 10/12/2017 09:14", | ||
"test04useGettersAndSetters" : "rhi 10/12/2017 09:15", | ||
"test05whoIAmTellsYouClass" : "rhi 10/12/2017 09:25", | ||
"test06classesUnderstandCanUnderstand" : "rhi 10/12/2017 09:24" } } | ||
"test06classesUnderstandCanUnderstand" : "ek 6/14/2023 11:11" } } |
1 change: 1 addition & 0 deletions
1
src/Koans-Chapters.package/KoanAboutNil.class/instance/test01thereIsOnlyOneNil.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
tests | ||
test01thereIsOnlyOneNil | ||
"The concept of nil represents nothingness. How many nil objects are there?" | ||
|
||
self assert: xx equals: self class countAllInstancesOfNil |
1 change: 1 addition & 0 deletions
1
src/Koans-Chapters.package/KoanAboutNil.class/instance/test02variablesAreInitializedToNil.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
tests | ||
test02variablesAreInitializedToNil | ||
"What value does a variable have before one is assigned?" | ||
|
||
| aVariable | | ||
self assert: xx equals: aVariable |
1 change: 1 addition & 0 deletions
1
src/Koans-Chapters.package/KoanAboutNil.class/instance/test03nilIsJustAnotherObject.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
tests | ||
test03nilIsJustAnotherObject | ||
"What is the class of the nil object?" | ||
|
||
self assert: xx equals: nil class | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...oans-Chapters.package/KoanAboutObjects.class/class/koan07useCascadesToNotRepeatSuccess.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
hints-explanations | ||
koan07useCascadesToNotRepeatSuccess | ||
|
||
^ 'Success! Cascades should be used whenever you send multiple messages to the same receiver.' |
4 changes: 4 additions & 0 deletions
4
....package/KoanAboutObjects.class/class/koan08useCascadesToNotRepeatButBeCareful1Success.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
hints-explanations | ||
koan08useCascadesToNotRepeatButBeCareful1Success | ||
|
||
^ 'Success! The return value of #add: is the newly added value, not the collection it was added to.' |
4 changes: 4 additions & 0 deletions
4
....package/KoanAboutObjects.class/class/koan09useCascadesToNotRepeatButBeCareful2Success.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
hints-explanations | ||
koan09useCascadesToNotRepeatButBeCareful2Success | ||
|
||
^ 'Success! Methods such as #reversed and #asUppercase do not change the original String but instead return a copy.' |
2 changes: 1 addition & 1 deletion
2
src/Koans-Chapters.package/KoanAboutObjects.class/instance/test07useCascadesToNotRepeat.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...Koans-Chapters.package/KoanAboutObjects.class/instance/test10yourselfIsTheObjectItself.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters