Skip to content

Commit

Permalink
Adapt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jecisc committed Sep 14, 2023
1 parent d4f0c4d commit 9d192ce
Show file tree
Hide file tree
Showing 19 changed files with 332 additions and 4 deletions.
3 changes: 3 additions & 0 deletions MonticelloTonel-Core.package/TonelWriterV3.class/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
I'm a monticello writer for tonel format, writing the v3.0 of the format.

v3.0 in the Pharo version exports the packages and tags as different properties. In legacy mode the categories are still exported but this can be disabled.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"commentStamp" : "",
"commentStamp" : "CyrilFerlicot 9/14/2023 14:10",
"super" : "TonelWriter",
"category" : "MonticelloTonel-Core-Writing",
"classinstvars" : [ ],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
private - accessing
actualClass

^ TonelWriterV3
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
private
expectedBinaryInstanceMethodSourceCode

^ '
{ #category : ''accessing'' }
Object >> + a [.
^ 42
]
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
private
expectedClassDefinitionWithTraitCompositionFromRealClassSourceCode

^ 'Class {
#name : ''SomeObject'',
#superclass : ''Object'',
#traits : ''T1 + T2'',
#classTraits : ''T1 classTrait + T2 classTrait'',
#category : ''MonticelloTonel-Tests'',
#package : ''MonticelloTonel-Tests''
}
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
private
expectedClassDefinitionWithTraitCompositionSourceCode

^ '"
comment test
"
Class {
#name : ''SomeObject'',
#superclass : ''Object'',
#traits : ''T1 + T2'',
#classTraits : ''T1 classTrait + T2 classTrait'',
#category : ''Kernel'',
#package : ''Kernel''
}
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
private
expectedClassWithTraitsDefinitionSourceCode

^ 'Class {
#name : ''SomeObject2'',
#superclass : ''Object'',
#traits : ''T1 + T2'',
#classTraits : ''(T1 classTrait + T2 classTrait) - {#m1}'',
#category : ''MonticelloTonel-Tests'',
#package : ''MonticelloTonel-Tests''
}
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
private
expectedComparisonMethodSourceCode

^ '
{ #category : ''comparing'' }
Object >> = anObject [
^ self == anObject
]
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
private
expectedKeywordInstanceMethodSourceCode

^ '
{ #category : ''accessing'' }
Object >> min: a max: b [.
^ 42
]
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
private
expectedMTMockASubclassClassSt
^ '"
A mock class to verify serialization using Tonel format (as a subclass of MTMockClassA) with an instance and a class variable
"
Class {
#name : ''MTMockSubclassOfA'',
#superclass : ''MTMockClassA'',
#instVars : [
''x''
],
#classVars : [
''Y''
],
#category : ''MonticelloTonel-Tests-Mocks-Base'',
#package : ''MonticelloTonel-Tests-Mocks'',
#tag : ''Base''
}
{ #category : ''class initialization'' }
MTMockSubclassOfA class >> initialize [
InitializationOrder := InitializationOrder
ifNil: [ "let the test fail" -100 ]
ifNotNil: [ InitializationOrder + 1 ]
]
{ #category : ''accessing'' }
MTMockSubclassOfA >> variables [
^ x + Y + MTMockClassA
]
{ #category : ''accessing'' }
MTMockSubclassOfA >> variables2 [
^ ivar + CVar
]
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
private
expectedMTMockClassAClassSt
^ '"
A mock class to verify serialization using Tonel format
"
Class {
#name : ''MTMockClassA'',
#superclass : ''MTMock'',
#instVars : [
''ivar''
],
#classVars : [
''CVar'',
''InitializationOrder''
],
#category : ''MonticelloTonel-Tests-Mocks-Base'',
#package : ''MonticelloTonel-Tests-Mocks'',
#tag : ''Base''
}
{ #category : ''accessing'' }
MTMockClassA class >> cVar [
^ CVar
]
{ #category : ''accessing'' }
MTMockClassA class >> initializationOrder [
^ InitializationOrder
]
{ #category : ''class initialization'' }
MTMockClassA class >> initialize [
CVar := #initialized.
InitializationOrder := 1
]
{ #category : ''accessing'' }
MTMockClassA class >> one [
^ 1
]
{ #category : ''operating'' }
MTMockClassA class >> touchCVar [
CVar := #touched
]
{ #category : ''numeric'' }
MTMockClassA >> a [
^ ''a2''
]
{ #category : ''numeric'' }
MTMockClassA >> b [
^ ''b1''
]
{ #category : ''numeric'' }
MTMockClassA >> c [
^ ''c1''
]
{ #category : ''numeric'' }
MTMockClassA >> d [
^ ''d''
]
{ #category : ''boolean'' }
MTMockClassA >> falsehood [
^ false
]
{ #category : ''don\''nt remove'' }
MTMockClassA >> methodInCategoryWithApostrophe [
"A method that is grouped in a method category with an apostrophe"
]
{ #category : ''boolean'' }
MTMockClassA >> moreTruth [
^ true
]
{ #category : ''numeric'' }
MTMockClassA >> one [
^ 1
]
{ #category : ''boolean'' }
MTMockClassA >> truth [
^ true
]
{ #category : ''numeric'' }
MTMockClassA >> two [
^ 2
]
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
private
expectedSomeObjectClassDefinitionSourceCode

^ '"
comment test
"
Class {
#name : ''SomeObject'',
#superclass : ''Object'',
#category : ''Kernel'',
#package : ''Kernel''
}
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
private
expectedSomeObjectClassDefinitionWithVariablesSourceCode

^ '"
comment test
"
Class {
#name : ''SomeObject'',
#superclass : ''Object'',
#instVars : [
''a'',
''b'',
''c''
],
#classVars : [
''D'',
''E''
],
#pools : [
''POOL''
],
#classInstVars : [
''instVarA''
],
#category : ''Kernel'',
#package : ''Kernel''
}
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
private
expectedSourceCodeForTonelMock

^ '"
Description
--------------------
I am a simple Mock for Tonel export test
"
Class {
#name : ''TonelMock'',
#superclass : ''Object'',
#category : ''MonticelloTonel-Tests-Mocking'',
#package : ''MonticelloTonel-Tests'',
#tag : ''Mocking''
}
{ #category : ''accessing'' }
TonelMock class >> classMethod [
^ 8
]
{ #category : ''accessing'' }
TonelMock >> instanceMethod [
^ true
]
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
private
expectedTonelWriterExtensionSt
^ 'Extension { #name : ''TonelWriter'' }
{ #category : ''*MonticelloTonel-Tests-Mocks'' }
TonelWriter >> mockClassExtension [
"A mocked class extension used in tests - this method has to stay as an instance side extension on class TonelWriter and the extension method has to be packaged in MonticelloTonel-Tests-Mocks"
]
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
private
expectedUnaryClassMethodSourceCode

^ '
{ #category : ''accessing'' }
Object class >> selector [
^ 42
]
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
private
expectedUnaryInstanceMethodSourceCode

^ '
{ #category : ''accessing'' }
Object >> selector [
^ 42
]
'
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
private
expectedUnaryInstanceMethodWithDotAfterSelectorSourceCode

^ '
{ #category : ''accessing'' }
Object >> selector [.
^ 42
]
'
6 changes: 3 additions & 3 deletions MonticelloTonel-Tests.package/monticello.meta/categories.st
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SystemOrganization addCategory: #'MonticelloTonel-Tests'!
SystemOrganization addCategory: #'MonticelloTonel-Tests-Base'!
SystemOrganization addCategory: #'MonticelloTonel-Tests-Mocking'!
SystemOrganization addCategory: #'MonticelloTonel-Tests-Resources'!
SystemOrganization addCategory: #'MonticelloTonel-Tests-Mocking-MonticelloTonel-Tests'!
SystemOrganization addCategory: #'MonticelloTonel-Tests-Mocking-MonticelloTonel-Tests-Base'!
SystemOrganization addCategory: #'MonticelloTonel-Tests-Mocking-MonticelloTonel-Tests-Resources'!

0 comments on commit 9d192ce

Please sign in to comment.