Pharo-dev
By thread
pharo-dev@lists.pharo.org
By month
Messages by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 1 participants
- 144621 messages
Re: [Pharo-project] Tiling windows
by laurent laffont
On Sun, May 22, 2011 at 8:25 PM, laurent laffont
<laurent.laffont(a)gmail.com>wrote:
> Hi,
>
> what do you think of adding this in Pharo ?
>
(I forgot I've hacked TaskBarMorph to make it working well but the idea is
here :)
>
> |taskbar tileWindowsBlock|
>
> tileWindowsBlock := [
> |windows numberOfColumns numberOfRows windowWidth windowHeight|
> windows := (World submorphs select: [:m| m isSystemWindow and: [m
> isNotMinimized]]) asOrderedCollection.
> numberOfColumns := windows size sqrtFloor.
> numberOfRows := (windows size / numberOfColumns) rounded.
> windowWidth := World width // numberOfColumns..
> windowHeight := World height - taskbar height // numberOfRows.
>
> Matrix
> rows: numberOfRows
> columns: numberOfColumns
> tabulate: [:row :column| |window|
> windows ifNotEmpty: [
> window := windows remove: windows first.
> window
> bounds: (
> ((column - 1 * windowWidth) @ (row - 1 * windowHeight))
> extent: (windowWidth) @ windowHeight)
> ]
> ]
> ].
>
>
> taskbar := (World submorphs detect: [:m| m isTaskbar]).
>
> taskbar
> addMorph: (IconicButton new
> target: tileWindowsBlock;
> actionSelector: #value;
> labelGraphic: taskbar theme smallWindowIcon;
> color: Color transparent;
> yourself).
>
>
> Laurent Laffont - @lolgzs <http://twitter.com/#!/lolgzs>
>
> Pharo Smalltalk Screencasts: http://www.pharocasts.com/
> Blog: http://magaloma.blogspot.com/
> Developer group: http://cara74.seasidehosting.st
>
>
May 22, 2011
Re: [Pharo-project] problem with Dictionary and KeyNowFound
by Mariano Martinez Peck
So Camillo, can we just print the name of the collection (instead of all of
it and get the loop) in the description of KeyNotFound?
thanks
On Fri, May 20, 2011 at 9:27 AM, Stéphane Ducasse <stephane.ducasse(a)inria.fr
> wrote:
> I would like to have tests covering that!
>
> On May 20, 2011, at 12:34 AM, Camillo Bruni wrote:
>
> >
> > On 2011-05-20, at 00:03, Mariano Martinez Peck wrote:
> >
> >> On Thu, May 19, 2011 at 11:55 PM, Camillo Bruni <camillo.bruni(a)inria.fr
> >wrote:
> >>
> >>> IMO this shouldn't change a thing, since KeyNotFound inherits from
> Error...
> >>> having a look at it
> >>>
> >>> yes i know :(
> >> but in pharo 1.2 it works. That's why I thought it could be related to
> >> that.
> >
> > ok, the bug seems to be related to catching the signaller, dunno why, but
> commenting out the section on Exception >> signal seems to solve the issue.
> >
> > I will have a look at it tomorrow.
> >
> > camillo
> >
> >>> On 2011-05-19, at 23:45, Mariano Martinez Peck wrote:
> >>>> So...it seems Pharo1.3 change Dictionary to throw KeyNotFound instead
> of
> >>> Error.
> >>>> Now, my image freezes with a loop. I would appreciate some help. I
> >>> couldn't really analyzed the problem.
> >>>> Fileine both FLPerson.st and ATest and run the test
> testDictionaryRehash.
> >>>> In such test, a the end there is a
> >>>>
> >>>> self shouldnt: [aDictionary at: newPerson1] raise: KeyNotFound.
> >>>>
> >>>>
> >>>> which raises the debugger pre-popup. if I try to click on the popup...
> ->
> >>> loop/freeze.
> >>>> You can interrupt it and see more or less what is happening.
> >>>>
> >>>> Camillo, can you take a look?
> >>>
> >>
> >>
> >>
> >> --
> >> Mariano
> >> http://marianopeck.wordpress.com
> >
> >
>
>
--
Mariano
http://marianopeck.wordpress.com
May 22, 2011
[Pharo-project] Tiling windows
by laurent laffont
Hi,
what do you think of adding this in Pharo ?
|taskbar tileWindowsBlock|
tileWindowsBlock := [
|windows numberOfColumns numberOfRows windowWidth windowHeight|
windows := (World submorphs select: [:m| m isSystemWindow and: [m
isNotMinimized]]) asOrderedCollection.
numberOfColumns := windows size sqrtFloor.
numberOfRows := (windows size / numberOfColumns) rounded.
windowWidth := World width // numberOfColumns..
windowHeight := World height - taskbar height // numberOfRows.
Matrix
rows: numberOfRows
columns: numberOfColumns
tabulate: [:row :column| |window|
windows ifNotEmpty: [
window := windows remove: windows first.
window
bounds: (
((column - 1 * windowWidth) @ (row - 1 * windowHeight))
extent: (windowWidth) @ windowHeight)
]
]
].
taskbar := (World submorphs detect: [:m| m isTaskbar]).
taskbar
addMorph: (IconicButton new
target: tileWindowsBlock;
actionSelector: #value;
labelGraphic: taskbar theme smallWindowIcon;
color: Color transparent;
yourself).
Laurent Laffont - @lolgzs <http://twitter.com/#!/lolgzs>
Pharo Smalltalk Screencasts: http://www.pharocasts.com/
Blog: http://magaloma.blogspot.com/
Developer group: http://cara74.seasidehosting.st
May 22, 2011
Re: [Pharo-project] Any alternative to HDTestReport?
by Stéphane Ducasse
I would like to add that in the default image.
Could you create a bug entry and add your cs?
Stefan did you sign the license agreemnet?
Stef
On May 22, 2011, at 4:41 PM, Stefan Marr wrote:
> Hi Lukas:
>
>
> On 22 May 2011, at 13:32, Lukas Renggli wrote:
>
>>> Is there any alternative available to HDTestReport to be able to run headless tests, or actually run the SUnit tests in a non-morphic image?
>>
>> Not that I know of.
> Ok, thanks.
>
> The code below is a shameless ripoff of yours, stripped down to the basics, and meant for people that need a quick hack runner/reporter for SUnit test cases in a transcript or on any other stream for that matter.
>
> So, in case anyone finds it useful, here you go:
>
> 'From Pharo1.3a of ''18 January 2011'' [Latest update: #13207] on 22 May 2011 at 4:35:01 pm'!
> Object subclass: #TestConsoleRunner
> instanceVariableNames: 'suite suitePosition suiteTime suiteFailures suiteErrors stream'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'SUnit-UI'!
>
> !TestConsoleRunner methodsFor: 'initialization' stamp: 'StefanMarr 5/22/2011 15:58'!
> initialize
> stream := self class defaultOutputTarget! !
>
> !TestConsoleRunner methodsFor: 'initialization' stamp: 'StefanMarr 5/22/2011 15:53'!
> initializeOn: aTestSuite
> suite := aTestSuite.
> suitePosition := suiteTime := suiteFailures := suiteErrors := 0! !
>
>
> !TestConsoleRunner methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:54'!
> run
> Author uniqueInstance
> ifUnknownAuthorUse: 'TestConsoleRunner'
> during: [ [
> self setUp.
> suiteTime := [ self runAll ]
> timeToRun ]
> ensure: [ self tearDown ] ]! !
>
> !TestConsoleRunner methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 16:03'!
> runAll
> suite tests do: [ :each | each run: self ]! !
>
> !TestConsoleRunner methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 16:03'!
> runCase: aTestCase
> | error time stack |
> time := [ [ aTestCase runCase ]
> on: Halt , Error, TestFailure
> do: [ :err |
> error := err.
> stack := self stackTraceString: err of: aTestCase ] ]
> timeToRun.
> self beginTestCase: aTestCase time: time.
> (error isNil or: [ aTestCase expectedFailures includes: aTestCase selector ]) ifFalse: [
> (error isKindOf: TestFailure)
> ifTrue: [ self writeError: error stack: stack ]
> ifFalse: [ self writeError: error stack: stack ] ].
> self endTestCase! !
>
> !TestConsoleRunner methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 16:03'!
> setUp
> stream nextPutAll: 'TestSuite '; nextPutAll: suite name; nextPutAll: ':'; nextPut: Character lf.
> stream nextPutAll: 'Tests: '; print: suite tests size; nextPut: Character lf.
>
> "Initialize the test resources."
> suite resources do: [ :each |
> each isAvailable
> ifFalse: [ each signalInitializationError ] ]! !
>
> !TestConsoleRunner methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 16:18'!
> tearDown
> suite resources
> do: [ :each | each reset ].
>
> stream nextPutAll: 'failures='; print: suiteFailures;
> tab;
> nextPutAll:'errors='; print: suiteErrors;
> tab;
> nextPutAll: 'time='; print: suiteTime / 1000.0;
> nextPut: Character lf.
> ! !
>
>
> !TestConsoleRunner methodsFor: 'private' stamp: 'StefanMarr 5/22/2011 16:16'!
> beginTestCase: aTestCase time: time
> stream tab;
> nextPutAll: (aTestCase class category); nextPut: $.;
> nextPutAll: (aTestCase class name); nextPut: $.;
> nextPutAll: (aTestCase selector);
> tab;
> nextPutAll: 'time='; print: time / 1000.0;
> nextPut: Character lf! !
>
> !TestConsoleRunner methodsFor: 'private' stamp: 'StefanMarr 5/22/2011 16:16'!
> endTestCase
> stream tab;
> nextPut: Character lf! !
>
> !TestConsoleRunner methodsFor: 'private' stamp: 'StefanMarr 5/22/2011 16:28'!
> stackTraceString: err of: aTestCase
> ^ String streamContents: [ :str |
> | context |
> context := err signalerContext.
> [ context isNil or: [ context receiver == aTestCase and: [ context methodSelector == #runCase ] ] ] whileFalse: [
> str print: context; nextPut: Character lf.
> context := context sender ] ] ! !
>
> !TestConsoleRunner methodsFor: 'private' stamp: 'StefanMarr 5/22/2011 16:30'!
> writeError: error stack: stack
> suiteErrors := suiteErrors + 1.
> stream tab; tab;
> nextPutAll: 'Error type='; nextPutAll: (error class name);
> tab;
> nextPutAll: ' message='; nextPutAll: (error messageText ifNil: [ error description ]);
> nextPut: Character lf;
> nextPutAll: stack;
> nextPut: Character lf;
> nextPut: Character lf! !
>
> !TestConsoleRunner methodsFor: 'private' stamp: 'StefanMarr 5/22/2011 16:31'!
> writeFailure: error stack: stack
> suiteFailures := suiteFailures + 1.
>
> stream tab; tab;
> nextPutAll: 'Failure type='; nextPutAll: (error class name);
> tab;
> nextPutAll: 'message='; nextPutAll: (error messageText ifNil: [ error description ]);
> nextPut: Character lf;
> nextPutAll: stack;
> nextPut: Character lf;
> nextPut: Character lf! !
>
> "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
>
> TestConsoleRunner class
> instanceVariableNames: ''!
>
> !TestConsoleRunner class methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:50'!
> runCategories: aCollectionOfStrings
> ^ aCollectionOfStrings do: [ :each | self runCategory: each ]! !
>
> !TestConsoleRunner class methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:50'!
> runCategory: aString
> ^ self runClasses: (Smalltalk organization classesInCategory: aString) named: aString! !
>
> !TestConsoleRunner class methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:52'!
> runClasses: aCollectionOfClasses named: aString
> | suite classes |
> suite := TestSuite named: aString.
> classes := (aCollectionOfClasses
> select: [ :each | (each includesBehavior: TestCase) and: [ each isAbstract not ] ])
> asSortedCollection: [ :a :b | a name <= b name ].
> classes isEmpty
> ifTrue: [ ^ self ].
> classes
> do: [ :each | each addToSuiteFromSelectors: suite ].
> ^ self runSuite: suite! !
>
> !TestConsoleRunner class methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:52'!
> runPackage: aString
> ^ self runClasses: (PackageInfo named: aString) classes named: aString! !
>
> !TestConsoleRunner class methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:50'!
> runPackages: aCollectionOfStrings
> ^ aCollectionOfStrings do: [ :each | self runPackage: each ]! !
>
> !TestConsoleRunner class methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:52'!
> runSuite: aTestSuite
> ^ self new
> initializeOn: aTestSuite;
> run! !
>
>
> !TestConsoleRunner class methodsFor: 'defaults' stamp: 'StefanMarr 5/22/2011 15:57'!
> defaultOutputTarget
> ^ Transcript! !
>
>
>
> Best regards
> Stefan
>
>
>
>
>
> --
> Stefan Marr
> Software Languages Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://soft.vub.ac.be/~smarr
> Phone: +32 2 629 2974
> Fax: +32 2 629 3525
>
>
May 22, 2011
Re: [Pharo-project] [Hudson] Jenkins
by Stéphane Ducasse
On May 22, 2011, at 11:39 AM, Geert Claes wrote:
> No no, I have heard about these network admin nazi's and I feel for you :)
I would not call them like that because in the past I faced annoying admin complaining
about my image files... and the guys at inria are all except that.
The problem is not that they do not want but they got 3 guys on the 5 of the team
leaving or redispatch doing different things.
In addition they always try to do their best but INRIA is not a university kind of set up
but a ministry of defense classified building and they take care of our servers.
So we just follow their process and are happy. In october there will be an engineer only
working on maintaining hudson infrastructure and this is a really great news.
> Just forget my suggestion, branding and marketing have never really been
> Smalltalk's problem ;)
>
> --
> View this message in context: http://forum.world.st/Hudson-Jenkins-tp3538245p3541778.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
>
May 22, 2011
[Pharo-project] [update 1.3] #13209
by Marcus Denker
13209
-----
Issue 4103: System -> Update menu entry activated for Developer Images in Pharo 1.3
--
Marcus Denker -- http://www.marcusdenker.de
INRIA Lille -- Nord Europe. Team RMoD.
May 22, 2011
Re: [Pharo-project] bug in Nautilus/RPackage?
by Stéphane Ducasse
tx
now benjmain will be able to react.
Stef
On May 22, 2011, at 1:55 AM, Alexandre Bergel wrote:
> Hi!
>
> I took a fresh 1.3 image, and do it the following:
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Gofer new
> squeaksource: 'Spy';
> package: 'ConfigurationOfSpy';
> load.
> (Smalltalk at: #ConfigurationOfSpy) project lastVersion load.
>
> Gofer new
> squeaksource: 'Nautilus';
> package: 'ConfigurationOfNautilus';
> load.
> (Smalltalk at: #ConfigurationOfNautilus) project lastVersion load
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> I see the packages Spy, Spy-Core, .... Clicking on Spy-Core raises an error: Does not understand NautilusUI>>historyChanged. Below the pharo debug file
> <PharoDebug.log>
>
>
> When I load Nautilus first then Spy, only an empty Spy package appears in the browser with:
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Gofer new
> squeaksource: 'Nautilus';
> package: 'ConfigurationOfNautilus';
> load.
> (Smalltalk at: #ConfigurationOfNautilus) project lastVersion load.
>
> Gofer new
> squeaksource: 'Spy';
> package: 'ConfigurationOfSpy';
> load.
> (Smalltalk at: #ConfigurationOfSpy) project lastVersion load.
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> I am ready to push Nautilus.
>
> Cheers,
> Alexandre
>
> On 20 May 2011, at 17:50, Benjamin wrote:
>
>> Can you inspect the RPackageOrganizer to see if it comes from RPackage or from Nautilus please ?
>>
>>
>> Thanks in advance,
>>
>>
>> Ben
>>
>> On May 20, 2011, at 10:26 PM, Alexandre Bergel wrote:
>>
>>>> I don't know how to reproduce the situation in the screenshot, but I have a small idea of what the problem is:
>>>> Your package Spy is composed of several subcategories. All the classes are defined in the subcategories but none is defined in the one called 'Spy'.
>>>
>>> All Spy classes are defined in a category Spy-XXX
>>>
>>>> In Rpackage, the classes are put inside the RPackage matching the category in which the class is defined
>>>
>>> What does it mean? How comes that the package Spy was created? Where does it come from?
>>>
>>> I just took a fresh 1.3 one click, downloaded Nautilus then Spy. Spy appear as one single package called 'Spy'. No idea where it comes from.
>>>
>>> Alexandre
>>>
>>>>
>>>> 2011/5/19 Alexandre Bergel <alexandre.bergel(a)me.com>
>>>> Thanks for making it happen :-)
>>>>
>>>> Alexandre
>>>>
>>>>
>>>> On 19 May 2011, at 15:39, Stéphane Ducasse wrote:
>>>>
>>>>> thanks for reporting it.
>>>>>
>>>>> do you have a reproducable way of arriving to this state?
>>>>>
>>>>>> Hi !
>>>>>>
>>>>>> I think I bumped into a bug when using Nautilus. I am not sure whether this is due to RPackage or not.
>>>>>>
>>>>>> I loaded Spy, and apparently there is no class in the package within Nautilus.
>>>>>>
>>>>>> Cheers,
>>>>>> Alexandre
>>>>>> --
>>>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>>>> Alexandre Bergel http://www.bergel.eu
>>>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> <Screen shot 2011-05-19 at 11.21.23.png>
>>>>>
>>>>>
>>>>
>>>> --
>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>> Alexandre Bergel http://www.bergel.eu
>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
May 22, 2011
Re: [Pharo-project] ChangeSet changedMessageList broken
by Stéphane Ducasse
Hi Stefan
just that you know: One of the next milestone on our roadmap is to use a decent metamodel for sourcecode entities.
We have it, it is called Ring and we will slowly integrate it in the system. So we will have probably other problems
and create bugs but this is the price to pay.
Stef
> Hi:
>
> On 22 May 2011, at 01:56, Benjamin wrote:
>
>> The "problem" is that MethodReference were used either it was for a method or for a comment. And in this case, the selector was set to #Comment .
>> Now, there is SourcedMethodReference for methods, and CommentReference for comments.
>>
>> So this example should be changed I guess.
>
>
> So, the proper implementation would be the following? (now uses CommentReference)
>
> changedMessageList
> "Used by a message set browser to access the list view information."
>
> | messageList |
> messageList := OrderedCollection new.
> changeRecords associationsDo: [:clAssoc | | classNameInParts classNameInFull |
> classNameInFull := clAssoc key asString.
> classNameInParts := classNameInFull findTokens: ' '.
>
> (clAssoc value allChangeTypes includes: #comment) ifTrue:
> [messageList add:
> (CommentReference class: (Smalltalk globals classNamed: classNameInParts first))].
>
> clAssoc value methodChangeTypes associationsDo: [:mAssoc |
> (#(remove addedThenRemoved) includes: mAssoc value) ifFalse:
> [messageList add:
> (SourcedMethodReference new
> setClassSymbol: classNameInParts first asSymbol
> classIsMeta: classNameInParts size > 1
> methodSymbol: mAssoc key
> stringVersion: classNameInFull, ' ' , mAssoc key)]]].
> ^ messageList asArray sort
>
>
>
> Well well, thats not really nice. CommentReference is not entirely polymorphic to MethodReference.
>
> It should have
> CommentReference>>#category
> ^ self actualClass category
>
> to be able to move #topLevelPackageName from MethodReference to SourceReference. Every piece of source is part of some package, no? Including the class comments. Well, at least it breaks our file-out mechanism if that is not true.
>
> Best regards
> Stefan
>
>>
>>
>>
>> Ben
>>
>>
>> On May 21, 2011, at 11:41 PM, Stefan Marr wrote:
>>
>>> Hello:
>>>
>>> The following example is broken:
>>>
>>> ChangeSet new commentClass: ChangeSet; changedMessageList
>>>
>>> It will raise an exception that no #Comment message was found in the ChangeSet class.
>>> (BTW: the key not found error does not name the key, which is rather inconvenient)
>>>
>>> The reason seems to be a change in ChangeSet>>#changedMessageList.
>>>
>>> The change is tracked as being done by Benjamin Van Ryseghem (11/6/2010 22:11)
>>> and seems to switch from MethodReference to SourcedMethodReference, which breaks the example.
>>>
>>> Does anyone know the intention or context of this change?
>>> Is it possible to revert to Marcus' pervious version of that method?
>>>
>>> A test for this bug could be the lines of:
>>>
>>>
>>>
>>> testChangedMessageListAndComments
>>> | changeSet |
>>> changeSet := ChangeSet new.
>>> changeSet commentClass: ChangeSet.
>>> self assert: 1 equals: changeSet changedMessageList size.
>>> self assert: ((changeSet at: 1) isKindOf: MethodReference).
>>> self assert: #Comment equals: (changeSet at: 1) methodSymbol.
>>>
>>> Best regards
>>> Stefan
>>>
>>> --
>>> Stefan Marr
>>> Software Languages Lab
>>> Vrije Universiteit Brussel
>>> Pleinlaan 2 / B-1050 Brussels / Belgium
>>> http://soft.vub.ac.be/~smarr
>>> Phone: +32 2 629 2974
>>> Fax: +32 2 629 3525
>>>
>>>
>>
>>
>
> --
> Stefan Marr
> Software Languages Lab
> Vrije Universiteit Brussel
> Pleinlaan 2 / B-1050 Brussels / Belgium
> http://soft.vub.ac.be/~smarr
> Phone: +32 2 629 2974
> Fax: +32 2 629 3525
>
>
May 22, 2011
Re: [Pharo-project] Any alternative to HDTestReport?
by Stefan Marr
Hi Lukas:
On 22 May 2011, at 13:32, Lukas Renggli wrote:
>> Is there any alternative available to HDTestReport to be able to run headless tests, or actually run the SUnit tests in a non-morphic image?
>
> Not that I know of.
Ok, thanks.
The code below is a shameless ripoff of yours, stripped down to the basics, and meant for people that need a quick hack runner/reporter for SUnit test cases in a transcript or on any other stream for that matter.
So, in case anyone finds it useful, here you go:
'From Pharo1.3a of ''18 January 2011'' [Latest update: #13207] on 22 May 2011 at 4:35:01 pm'!
Object subclass: #TestConsoleRunner
instanceVariableNames: 'suite suitePosition suiteTime suiteFailures suiteErrors stream'
classVariableNames: ''
poolDictionaries: ''
category: 'SUnit-UI'!
!TestConsoleRunner methodsFor: 'initialization' stamp: 'StefanMarr 5/22/2011 15:58'!
initialize
stream := self class defaultOutputTarget! !
!TestConsoleRunner methodsFor: 'initialization' stamp: 'StefanMarr 5/22/2011 15:53'!
initializeOn: aTestSuite
suite := aTestSuite.
suitePosition := suiteTime := suiteFailures := suiteErrors := 0! !
!TestConsoleRunner methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:54'!
run
Author uniqueInstance
ifUnknownAuthorUse: 'TestConsoleRunner'
during: [ [
self setUp.
suiteTime := [ self runAll ]
timeToRun ]
ensure: [ self tearDown ] ]! !
!TestConsoleRunner methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 16:03'!
runAll
suite tests do: [ :each | each run: self ]! !
!TestConsoleRunner methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 16:03'!
runCase: aTestCase
| error time stack |
time := [ [ aTestCase runCase ]
on: Halt , Error, TestFailure
do: [ :err |
error := err.
stack := self stackTraceString: err of: aTestCase ] ]
timeToRun.
self beginTestCase: aTestCase time: time.
(error isNil or: [ aTestCase expectedFailures includes: aTestCase selector ]) ifFalse: [
(error isKindOf: TestFailure)
ifTrue: [ self writeError: error stack: stack ]
ifFalse: [ self writeError: error stack: stack ] ].
self endTestCase! !
!TestConsoleRunner methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 16:03'!
setUp
stream nextPutAll: 'TestSuite '; nextPutAll: suite name; nextPutAll: ':'; nextPut: Character lf.
stream nextPutAll: 'Tests: '; print: suite tests size; nextPut: Character lf.
"Initialize the test resources."
suite resources do: [ :each |
each isAvailable
ifFalse: [ each signalInitializationError ] ]! !
!TestConsoleRunner methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 16:18'!
tearDown
suite resources
do: [ :each | each reset ].
stream nextPutAll: 'failures='; print: suiteFailures;
tab;
nextPutAll:'errors='; print: suiteErrors;
tab;
nextPutAll: 'time='; print: suiteTime / 1000.0;
nextPut: Character lf.
! !
!TestConsoleRunner methodsFor: 'private' stamp: 'StefanMarr 5/22/2011 16:16'!
beginTestCase: aTestCase time: time
stream tab;
nextPutAll: (aTestCase class category); nextPut: $.;
nextPutAll: (aTestCase class name); nextPut: $.;
nextPutAll: (aTestCase selector);
tab;
nextPutAll: 'time='; print: time / 1000.0;
nextPut: Character lf! !
!TestConsoleRunner methodsFor: 'private' stamp: 'StefanMarr 5/22/2011 16:16'!
endTestCase
stream tab;
nextPut: Character lf! !
!TestConsoleRunner methodsFor: 'private' stamp: 'StefanMarr 5/22/2011 16:28'!
stackTraceString: err of: aTestCase
^ String streamContents: [ :str |
| context |
context := err signalerContext.
[ context isNil or: [ context receiver == aTestCase and: [ context methodSelector == #runCase ] ] ] whileFalse: [
str print: context; nextPut: Character lf.
context := context sender ] ] ! !
!TestConsoleRunner methodsFor: 'private' stamp: 'StefanMarr 5/22/2011 16:30'!
writeError: error stack: stack
suiteErrors := suiteErrors + 1.
stream tab; tab;
nextPutAll: 'Error type='; nextPutAll: (error class name);
tab;
nextPutAll: ' message='; nextPutAll: (error messageText ifNil: [ error description ]);
nextPut: Character lf;
nextPutAll: stack;
nextPut: Character lf;
nextPut: Character lf! !
!TestConsoleRunner methodsFor: 'private' stamp: 'StefanMarr 5/22/2011 16:31'!
writeFailure: error stack: stack
suiteFailures := suiteFailures + 1.
stream tab; tab;
nextPutAll: 'Failure type='; nextPutAll: (error class name);
tab;
nextPutAll: 'message='; nextPutAll: (error messageText ifNil: [ error description ]);
nextPut: Character lf;
nextPutAll: stack;
nextPut: Character lf;
nextPut: Character lf! !
"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
TestConsoleRunner class
instanceVariableNames: ''!
!TestConsoleRunner class methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:50'!
runCategories: aCollectionOfStrings
^ aCollectionOfStrings do: [ :each | self runCategory: each ]! !
!TestConsoleRunner class methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:50'!
runCategory: aString
^ self runClasses: (Smalltalk organization classesInCategory: aString) named: aString! !
!TestConsoleRunner class methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:52'!
runClasses: aCollectionOfClasses named: aString
| suite classes |
suite := TestSuite named: aString.
classes := (aCollectionOfClasses
select: [ :each | (each includesBehavior: TestCase) and: [ each isAbstract not ] ])
asSortedCollection: [ :a :b | a name <= b name ].
classes isEmpty
ifTrue: [ ^ self ].
classes
do: [ :each | each addToSuiteFromSelectors: suite ].
^ self runSuite: suite! !
!TestConsoleRunner class methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:52'!
runPackage: aString
^ self runClasses: (PackageInfo named: aString) classes named: aString! !
!TestConsoleRunner class methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:50'!
runPackages: aCollectionOfStrings
^ aCollectionOfStrings do: [ :each | self runPackage: each ]! !
!TestConsoleRunner class methodsFor: 'running' stamp: 'StefanMarr 5/22/2011 15:52'!
runSuite: aTestSuite
^ self new
initializeOn: aTestSuite;
run! !
!TestConsoleRunner class methodsFor: 'defaults' stamp: 'StefanMarr 5/22/2011 15:57'!
defaultOutputTarget
^ Transcript! !
Best regards
Stefan
--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax: +32 2 629 3525
May 22, 2011
Re: [Pharo-project] Any alternative to HDTestReport?
by Schwab,Wilhelm K
Lukas, Stefan,
SUnit might not be designed to be extensible, but does it have a choice? :) One thing that I have added for a long time is this:
TestCase class>>prod:aSymbol
( self selector:aSymbol ) runCase.
There are probably even better ways to do the same thing, but the idea has always been (thinking in GUI terms for the moment) that test runners are great for getting a summary of which tests pass and which ones fail. Once I decide to use a specific test to reproduce a defect I want to fix, there is probably already a #prod: message in a comment, something like this:
testFromGizmoWithAlarms
"5-11 - First alarm data"
| in out results monitorData |
"
GizmoTests prod:#testFromGizmoWithAlarms.
"
"5-11 - early alarm messages, maybe"
in := #[ ... ] readStreamORDataServer.
out := Array writeStream.
[ in atEnd ] whileFalse:[
out nextPut:( GizmoMessage readFromEncodedStream:in ).
].
self should:[ in atEnd ].
results := out contents.
results first data.
FWIW, far too many of these methods have breakpoints in them, so maybe I need a "global" switch to control the halts or a #prodAndDebug: method that will halt on a message send that #prod: ignores.
It is true that OB will do pretty much the same thing from the IDE (control-t - very cool).
The attached illustrates some more elaborate tricks that I have used. Note that the interesting stuff is Dolphin-specific and, as-is, probably won't work in Pharo. My point is mostly that with a few well chosen loose methods, SUnit can do things it was never intended to do, such as
SomeTestCase runTestsReferecing:#asMonitorData.
SomeTestCase runTestsReferecing:#realizeTabLineFor:.
or even
SomeTestCase runNonGraphicalTests.
SomeTestCase runGraphicalTests.
Bill
________________________________________
From: pharo-project-bounces(a)lists.gforge.inria.fr [pharo-project-bounces(a)lists.gforge.inria.fr] On Behalf Of Lukas Renggli [renggli(a)gmail.com]
Sent: Sunday, May 22, 2011 7:32 AM
To: Pharo-project(a)lists.gforge.inria.fr
Subject: Re: [Pharo-project] Any alternative to HDTestReport?
> Is there any alternative available to HDTestReport to be able to run headless tests, or actually run the SUnit tests in a non-morphic image?
Not that I know of.
> I found the HDTestReport via Lukas github repo, I think, and in the Pharo Core regression testing image.
> Is any of them ever going to be part of the standard SUnit?
I don't think that HDTestReport is useful (something more generic
would maybe). SUnit is not designed to be extensible and HDTestReport
is merely a hack to be able to execute SUnit tests and create a JUnit
compatible XML output so that Hudson can create nice graphs.
Lukas
--
Lukas Renggli
www.lukas-renggli.ch
May 22, 2011