Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added Grease-Tests-Squeak5-Core package as a fork of Grease-Tests-Pha…
…ro-Core to fix the tests
  • Loading branch information
Johan Brichau committed Feb 27, 2016
commit 91d1da2e66e06cfae4db19e4c50029a0fa524791
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ baseline: spec
with: [ spec includes: #('Grease-Tests-Squeak-Core') ];
package: 'Grease-Squeak5-Core'
with: [ spec requires: #('Grease-Core') ];
package: 'Grease-Tests-Pharo-Core'
with: [ spec requires: #('Grease-Tests-Core') ];
package: 'Grease-Tests-Squeak-Core'
with: [ spec requires: #('Grease-Tests-Pharo-Core') ].
self slimeForSqueakPharo1xPharo2x: spec ].
with: [ spec requires: #('Grease-Tests-Core') ];
package: 'Grease-Tests-Squeak5-Core'
with: [ spec requires: #('Grease-Tests-Squeak-Core') ].
self slimeForSqueakPharo1xPharo2x: spec ].
spec
for: #'pharo1.0'
do: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"class" : {
},
"instance" : {
"baseline:" : "JohanBrichau 2/27/2016 13:21",
"baseline:" : "JohanBrichau 2/27/2016 13:34",
"initializeLatin1ToUtf8Encodings" : "JohanBrichau 10/19/2014 10:00",
"slimeForSqueakPharo1xPharo2x:" : "JohanBrichau 02/16/2014 03:49" } }
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(name 'BaselineOfGrease-JohanBrichau.12' message 'added Pharo-Tests to Squeak5 load' id 'ffe11ade-e4f1-496d-ae59-74543cfad134' date '27 February 2016' time '1:21:56.832518 pm' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.11' message 'added pharo5 platform to baseline' id '5c0332e9-ef4c-43cd-9066-7c9fe9ed6506' date '27 February 2016' time '12:12:12.067693 pm' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.10' message 'added squeak 5 platform' id '18f9d568-869f-4550-804a-b0ba101f33f3' date '13 December 2015' time '8:36:25.150207 pm' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-dkh.9' message 'Update baseline for GemStone 3.3' id 'af9364dd-14bc-4e5e-9fc7-0abe08732ab2' date '26 May 2015' time '11:46:07 am' author 'dkh' ancestors ((name 'BaselineOfGrease-JohanBrichau.8' message 'separate package for Squeak' id '91c019c7-2b8b-40c3-97d9-2047a69512a7' date '22 March 2015' time '12:01:37 pm' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.7' message 'included Pharo 4 and did some baseline formatting' id '3722041d-d4b5-4496-a25a-0e891fe9a945' date '8 November 2014' time '9:28:01 am' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.6' message 'added initializeLatin1ToUtf8Encodings' id '4d976044-1aa9-44b6-bab0-b66ac758b3cd' date '19 October 2014' time '10:05:25 am' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.6' message 'added initializeLatin1ToUtf8Encodings' id 'b4ac5766-d472-4557-beff-59e5b733bce0' date '19 October 2014' time '10:04:55 am' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-dkh.5' message 'typoe' id '93eb3230-7956-4a6e-85dc-243f3dd895a1' date '4 June 2014' time '3:13:26 pm' author 'dkh' ancestors ((name 'BaselineOfGrease-dkh.4' message 'woops specified the package branch incorrectly ... I think I got it right this time...' id '3003ee31-9d17-4dd1-9b9a-f8a80e4f0ba1' date '4 June 2014' time '3:12:31 pm' author 'dkh' ancestors ((name 'BaselineOfGrease-dkh.3' message 'add Grease-Tests-GemStone-Core.v32 to baseline' id '26f128ca-b62e-4295-9a58-a9758b670c37' date '4 June 2014' time '2:57:48 pm' author 'dkh' ancestors ((name 'BaselineOfGrease-JohanBrichau.2' message 'forgotten methods' id '38758da9-c922-4530-a19e-f8783900e787' date '16 February 2014' time '3:50:22 am' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.1' message 'first baseline' id 'b89398df-14c6-4b6a-a2ba-91ad806bb07f' date '16 February 2014' time '1:49:46 am' author 'JohanBrichau' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
(name 'BaselineOfGrease-JohanBrichau.13' message 'Forked Grease-Tests-Pharo-Core into Grease-Tests-Squeak5-Core' id '3a01ebbc-8859-45db-ae5a-e5de8073d3a4' date '27 February 2016' time '1:40:18.726436 pm' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.12' message 'added Pharo-Tests to Squeak5 load' id 'ffe11ade-e4f1-496d-ae59-74543cfad134' date '27 February 2016' time '1:21:56.832518 pm' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.11' message 'added pharo5 platform to baseline' id '5c0332e9-ef4c-43cd-9066-7c9fe9ed6506' date '27 February 2016' time '12:12:12.067693 pm' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.10' message 'added squeak 5 platform' id '18f9d568-869f-4550-804a-b0ba101f33f3' date '13 December 2015' time '8:36:25.150207 pm' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-dkh.9' message 'Update baseline for GemStone 3.3' id 'af9364dd-14bc-4e5e-9fc7-0abe08732ab2' date '26 May 2015' time '11:46:07 am' author 'dkh' ancestors ((name 'BaselineOfGrease-JohanBrichau.8' message 'separate package for Squeak' id '91c019c7-2b8b-40c3-97d9-2047a69512a7' date '22 March 2015' time '12:01:37 pm' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.7' message 'included Pharo 4 and did some baseline formatting' id '3722041d-d4b5-4496-a25a-0e891fe9a945' date '8 November 2014' time '9:28:01 am' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.6' message 'added initializeLatin1ToUtf8Encodings' id '4d976044-1aa9-44b6-bab0-b66ac758b3cd' date '19 October 2014' time '10:05:25 am' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.6' message 'added initializeLatin1ToUtf8Encodings' id 'b4ac5766-d472-4557-beff-59e5b733bce0' date '19 October 2014' time '10:04:55 am' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-dkh.5' message 'typoe' id '93eb3230-7956-4a6e-85dc-243f3dd895a1' date '4 June 2014' time '3:13:26 pm' author 'dkh' ancestors ((name 'BaselineOfGrease-dkh.4' message 'woops specified the package branch incorrectly ... I think I got it right this time...' id '3003ee31-9d17-4dd1-9b9a-f8a80e4f0ba1' date '4 June 2014' time '3:12:31 pm' author 'dkh' ancestors ((name 'BaselineOfGrease-dkh.3' message 'add Grease-Tests-GemStone-Core.v32 to baseline' id '26f128ca-b62e-4295-9a58-a9758b670c37' date '4 June 2014' time '2:57:48 pm' author 'dkh' ancestors ((name 'BaselineOfGrease-JohanBrichau.2' message 'forgotten methods' id '38758da9-c922-4530-a19e-f8783900e787' date '16 February 2014' time '3:50:22 am' author 'JohanBrichau' ancestors ((name 'BaselineOfGrease-JohanBrichau.1' message 'first baseline' id 'b89398df-14c6-4b6a-a2ba-91ad806bb07f' date '16 February 2014' time '1:49:46 am' author 'JohanBrichau' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
4 changes: 4 additions & 0 deletions repository/Grease-Tests-Squeak5-Core.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*grease-tests-squeak5-core
greaseTestsSqueak5Core
^ self new
name: 'Grease-Tests-Squeak5-Core';
description: 'Unit tests for the package Grease-Squeak5-Core.';
addDependency: 'Grease-Squeak5-Core';
addDependency: 'Grease-Tests-Core';
url: #seasideUrl;
yourself
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
"greaseTestsSqueak5Core" : "JB 2/27/2016 13:28" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
"name" : "GRPackage" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
private
assert: aString next: anInteger startingAt: startIndex gives: anEncodedString
| actual |
actual := String streamContents: [ :stream |
((GRCodec forEncoding: 'utf-8') encoderFor: stream)
greaseNext: anInteger putAll: aString startingAt: startIndex ].
self assert: actual = anEncodedString
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
private
assertEncodingIgnoresLanguageTat: aStringWithLanguageTag
| codec withLanguageTag withoutLanguageTag |
codec := GRCodec forEncoding: 'utf-8'.
withLanguageTag := codec encode: aStringWithLanguageTag.
withoutLanguageTag := codec encode: (self stripLeadingCharFrom: aStringWithLanguageTag).
self assert: withLanguageTag = withoutLanguageTag
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
private
stripLeadingCharFrom: aString
"strips the leadingChar from every character in the given string"
^ String streamContents: [ :stream |
aString do: [ :each |
stream nextPut: (Character
leadingChar: 0
code: each greaseInteger) ] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tests
testAllCodesIncludesIso88591
self assert: (GRCodec allCodecs anySatisfy: [ :each |
each name = 'iso-8859-1' ])
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
tests
testGreaseNextPutAllStartingAt
| umlaut encodedUmlaut |
umlaut := String with: (Character codePoint: 228).
encodedUmlaut := String with: (Character codePoint: 195) with: (Character codePoint: 164).
self assert: 'ab' next: 1 startingAt: 1 gives: 'a'.
self assert: 'a', umlaut, 'b' next: 1 startingAt: 1 gives: 'a'.
self assert: 'ab', umlaut next: 1 startingAt: 1 gives: 'a'.
self assert: 'a', umlaut, 'b' next: 2 startingAt: 1gives: 'a', encodedUmlaut.
self assert: 'a', umlaut, 'b' next: 1 startingAt: 2 gives: encodedUmlaut.
self assert: 'a', umlaut, 'b' next: 2 startingAt: 2 gives: encodedUmlaut, 'b'.
self assert: 'a', umlaut, umlaut next: 2 startingAt: 2 gives: encodedUmlaut, encodedUmlaut.
self assert: 'ab', umlaut, 'b', umlaut next: 3 startingAt: 2 gives: 'b', encodedUmlaut, 'b'
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
tests
testLanguageTag
"this makes sure the encoder doesn't fall on the nose with unicode"
"Make Japanese String from unicode. see http://www.unicode.org/charts/PDF/U3040.pdf"
| leading hiraA hiraO hiraAO |
leading := (Smalltalk classNamed: #JapaneseEnvironment) leadingChar.
hiraA := (Character
leadingChar: leading
code: 12354) greaseString. "HIRAGANA LETTER A"
hiraO := (Character
leadingChar: leading
code: 12362) greaseString. "HIRAGANA LETTER O"
hiraAO := hiraA , hiraO.
self assertEncodingIgnoresLanguageTat: hiraA.
self assertEncodingIgnoresLanguageTat: hiraO.
self assertEncodingIgnoresLanguageTat: hiraAO
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"class" : {
},
"instance" : {
"assert:next:startingAt:gives:" : "pmm 4/21/2012 20:54",
"assertEncodingIgnoresLanguageTat:" : "pmm 12/26/2010 22:24",
"stripLeadingCharFrom:" : "pmm 12/26/2010 22:13",
"testAllCodesIncludesIso88591" : "pmm 8/16/2010 00:24",
"testGreaseNextPutAllStartingAt" : "pmm 5/21/2014 21:09",
"testLanguageTag" : "pmm 12/26/2010 22:25" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Grease-Tests-Squeak5-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "GRPharoCodecTest",
"pools" : [
],
"super" : "TestCase",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
testing
expectedFailures
^ #(testFromStringThreeDigit)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
testing
testAllColors
| toTest |
toTest := #(
16r000000 16r000001 16r000101 16r010101 16r010100 16r010000 16r001001 16r101001
16r001122 16r334455 16r667788 16r99AABB 16rCCDDEE 16rFF0011
16r123456 16r789ABC 16rDEFEDC
16rFEFEEF 16rFEFEFF 16rFEFEFE 16rFFFEFE 16rFFFFFE 16rFFFFFF).
toTest do: [ :int |
| hex |
hex := int printPaddedWith: $0 to: 6 base: 16.
self assert: (Color fromString: hex) asHTMLColor asLowercase = ('#', hex) asLowercase ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
testing
testColorAsHtmlColor
"test for:
Color >> #hex
| aStream |
aStream := (String new: 6) writeStream.
aStream nextPutAll: (((self red * 255) asInteger printStringBase: 16)
padded: #left to: 2 with: $0).
aStream nextPutAll: (((self green * 255) asInteger printStringBase: 16)
padded: #left to: 2 with: $0).
aStream nextPutAll: (((self blue * 255) asInteger printStringBase: 16)
padded: #left to: 2 with: $0).
^ aStream contents

Color >> #asHTMLColor
^ '#', self hex"
self assert: (#('#ffffff' '#FFFFFF' ) includes: Color white asHTMLColor).
self assert: (Color black asHTMLColor = '#000000').
self assert: (#('#ff0000' '#FF0000' ) includes: Color red asHTMLColor)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
testing
testFromSixDigit
self assert: (Color fromString: 'ff0000') = Color red.
self assert: (Color fromString: 'FF0000') = Color red.
self assert: (Color fromString: '#ff0000') = Color red.
self assert: (Color fromString: '#FF0000') = Color red
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
testing
testFromStringName
self assert: (Color fromString: 'red') = Color red.
self assert: (Color fromString: 'RED') = Color red.
self assert: (Color fromString: '#red') = Color red.
self assert: (Color fromString: '#RED') = Color red
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
testing
testFromStringSixDigit
self assert: (Color fromString: 'ff0000') = Color red.
self assert: (Color fromString: 'FF0000') = Color red.
self assert: (Color fromString: '#ff0000') = Color red.
self assert: (Color fromString: '#FF0000') = Color red
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
testing
testFromStringThreeDigit
self assert: (Color fromString: 'f00') = Color red.
self assert: (Color fromString: 'F00') = Color red.
self assert: (Color fromString: '#f00') = Color red.
self assert: (Color fromString: '#F00') = Color red
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"class" : {
},
"instance" : {
"expectedFailures" : "lr 7/25/2011 19:51",
"testAllColors" : "lr 7/25/2011 18:34",
"testColorAsHtmlColor" : "MAD 8/29/2008 15:36",
"testFromSixDigit" : "pmm 11/20/2008 22:00",
"testFromStringName" : "pmm 9/1/2012 15:32",
"testFromStringSixDigit" : "pmm 11/20/2008 22:01",
"testFromStringThreeDigit" : "pmm 9/1/2012 15:32" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Grease-Tests-Squeak5-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "GRPharoColorTest",
"pools" : [
],
"super" : "TestCase",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tests
testNoAmbiguities
#('utf-8' 'UTF-8' 'utf8') do: [ :each |
self deny: (GRPharoGenericCodec supportsEncoding: each) ].
GRPharoLatin1Codec supportedEncodingNames do: [ :each |
self deny: (GRPharoGenericCodec supportsEncoding: each) ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"class" : {
},
"instance" : {
"testNoAmbiguities" : "pmm 8/16/2010 00:47" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Grease-Tests-Squeak5-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "GRPharoGenericCodecTest",
"pools" : [
],
"super" : "TestCase",
"type" : "normal" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
tests
testCompileIntoClassified
| source protocol selectors selector |
source := 'aMethod
^ ''a result'''.
protocol := 'a-protocol'.
selector := #aMethod.
GRPlatform current
compile: source
into: self class
classified: protocol.

[ self assert: (self class selectors includes: selector).
selectors := self class organization listAtCategoryNamed: protocol.
self assert: selectors = (Array with: selector) ] ensure: [ self class removeSelectorSilently: selector ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tests
testFullName
self assert: Object fullName = 'Object'
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
tests
testGreaseIntegerOnCharacter
| character |
character := Character codePoint: 19982.
self assert: character greaseInteger = 19982.
character := Unicode value: 19982.
self assert: character greaseInteger = 19982.
LanguageEnvironment allSubclassesDo: [ :each |
(each class selectors includes: #leadingChar) ifTrue: [
"fuck me gently with a chainsaw"
character := Character
leadingChar: each leadingChar
code: 19982.
self assert: character greaseInteger = 19982 ] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
tests
testMessageSendValueWithPossibleArguments
| send |
send := MessageSend receiver: 1 selector: #+.
self assert: (send valueWithPossibleArguments: (Array with: 2)) = 3.
self assert: (send valueWithArguments: (Array with: 2)) = 3.
self assert: (send value: 2) = 3.

send := MessageSend receiver: false selector: #not.
self assert: (send valueWithPossibleArguments: (Array with: 3)).

send := MessageSend receiver: 1 selector: #+ arguments: #(2).
self assert: (send valueWithPossibleArguments: (Array with: 4)) = 3.
self assert: send value = 3.

send := MessageSend receiver: Array selector: #with:with: arguments: #(1).
self assert: (send valueWithPossibleArguments: (Array with: 2)) size = 2.

send := MessageSend receiver: Array selector: #with:with:.
self assert: (send value: 1 value: 2) size = 2.

send := MessageSend
receiver: 1
selector: #+.
self assert: send argumentCount = 1.
self assert: send arguments size = 0.
self assert: send fixCallbackTemps == send.

send := MessageSend
receiver: 1
selector: #+
argument: 2.
self assert: send argumentCount isZero.
self assert: send arguments size = 1.
self assert: send fixCallbackTemps == send
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tests
testWriteToFileInFolderBinary
self writeToFile: #(80 104 39 110 103 108 117 105 32 109 103 108 119 39 110 97 102 104 32 67 116 104 117 108 104 117 32 82 39 108 121 101 104 32 119 103 97 104 39 110 97 103 108 32 102 104 116 97 103 110) asByteArray
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tests
testWriteToFileInFolderText
self writeToFile: 'Ph''nglui mglw''nafh Cthulhu R''lyeh wgah''nagl fhtagn'
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
private
writeToFile: aStringOrByteArray
| fileName directory |
fileName := 'GRPharoPlatformTest'.
directory := FileDirectory default.
[ GRPlatform current
write: aStringOrByteArray
toFile: fileName
inFolder: directory pathName
] ensure: [
directory deleteFileNamed: fileName ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"class" : {
},
"instance" : {
"testCompileIntoClassified" : "jf 9/30/2009 00:19",
"testFullName" : "jf 10/6/2008 14:37",
"testGreaseIntegerOnCharacter" : "pmm 12/26/2010 21:44",
"testMessageSendValueWithPossibleArguments" : "jf 12/18/2009 12:29",
"testWriteToFileInFolderBinary" : "pmm 1/22/2012 16:09",
"testWriteToFileInFolderText" : "pmm 1/22/2012 15:54",
"writeToFile:" : "pmm 1/22/2012 15:57" } }
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Grease-Tests-Squeak5-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "GRPharoPlatformTest",
"pools" : [
],
"super" : "TestCase",
"type" : "normal" }
Loading