[squeak-dev] The Trunk: Tests-nice.124.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Mar 30 19:59:02 UTC 2011


Nicolas Cellier uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-nice.124.mcz

==================== Summary ====================

Name: Tests-nice.124
Author: nice
Time: 30 March 2011, 9:58:44.797 pm
UUID: 215347fc-b044-40a0-b4d8-671b12c67baf
Ancestors: Tests-ul.123

Use #newCompiler #newParser

=============== Diff against Tests-ul.123 ===============

Item was changed:
  ----- Method: ClosureCompilerTest>>testDecompiledDoitMethodTempNames (in category 'tests') -----
  testDecompiledDoitMethodTempNames
  	"self new testDecompiledDoitMethodTempNames"
  	"Test that a decompiled doit that has been copied with temps decompiles to the input"
  	| removeComments |
  	removeComments := [:n| n comment: nil].
  	self closureCases do:
  		[:source| | mns m mps mnps |
  		"Need to compare an ungenerated tree with the generated method's methodNode
  		 because generating code alters the tree when it introduces remote temp vectors."
  		mns := #(first last) collect:
  					[:ignored|
  					source first isLetter
  						ifTrue:
+ 							[self class newCompiler
- 							[self class compilerClass new
  								compile: source
  								in: self class
  								notifying: nil
  								ifFail: [self error: 'compilation error']]
  						ifFalse:
+ 							[self class newCompiler
- 							[self class compilerClass new
  								compileNoPattern: source
  								in: self class
  								context: nil
  								notifying: nil
  								ifFail: [self error: 'compilation error']]].
  		m := (mns last generateWithTempNames).
  		removeComments value: mns first.
  		mns first nodesDo: removeComments.
  		self assert: (mnps := mns first printString) = (mps := m methodNode printString)]!

Item was changed:
  ----- Method: ClosureCompilerTest>>testMethodAndNodeTempNames (in category 'tests') -----
  testMethodAndNodeTempNames
  	"self new testMethodAndNodeTempNames"
  	"Test that BytecodeAgnosticMethodNode>>blockExtentsToTempRefs answers the same
  	 structure as CompiledMethod>>blockExtentsToTempRefs when the method has been
  	 copied with the appropriate temps.  This tests whether doit methods are debuggable
  	 since they carry their own temps."
  	self closureCases do:
  		[:source| | mn om m mbe obe |
  		mn := source first isLetter
  					ifTrue:
+ 						[self class newCompiler
- 						[self class compilerClass new
  							compile: source
  							in: self class
  							notifying: nil
  							ifFail: [self error: 'compilation error']]
  					ifFalse:
+ 						[self class newCompiler
- 						[self class compilerClass new
  							compileNoPattern: source
  							in: self class
  							context: nil
  							notifying: nil
  							ifFail: [self error: 'compilation error']].
  		m := (om := mn generate) copyWithTempsFromMethodNode: mn.
  		self assert: m holdsTempNames.
  		self assert: m endPC = om endPC.
  		mbe := m blockExtentsToTempsMap.
  		obe := mn blockExtentsToTempsMap.
  		self assert: mbe keys asSet = obe keys asSet.
  		(mbe keys intersection: obe keys) do:
  			[:interval|
  			self assert: (mbe at: interval) = (obe at: interval)]]!

Item was changed:
  ----- Method: DecompilerTests>>checkDecompileMethod: (in category 'utilities') -----
  checkDecompileMethod: oldMethod
  	
  	| cls selector oldMethodNode methodNode newMethod oldCodeString newCodeString |
  	cls := oldMethod methodClass.
  	selector := oldMethod selector.
  	oldMethodNode := (cls decompilerClass new withTempNames: oldMethod methodNode schematicTempNamesString)
  						decompile: selector
  						in: cls
  						method: oldMethod.
  	[oldMethodNode properties includesKey: #warning] whileTrue:
  		[oldMethodNode properties removeKey: #warning].
  	oldCodeString := oldMethodNode decompileString.
+ 	methodNode := [cls newCompiler
- 	methodNode := [cls compilerClass new
  						compile: oldCodeString
  						in: cls
  						notifying: nil
  						ifFail: []]
  						on: SyntaxErrorNotification
  						do: [:ex|
  							ex errorMessage = 'Cannot store into' ifTrue:
  								[ex return: #badStore].
  							ex pass].
  	"Ignore cannot store into block arg errors; they're not our issue."
  	methodNode ~~ #badStore ifTrue:
  		[newMethod := methodNode generate.
  		 newCodeString := ((cls decompilerClass new withTempNames: methodNode schematicTempNamesString)
  							decompile: selector
  							in: cls
  							method: newMethod) decompileString.
  		 "(StringHolder new textContents:
  			(TextDiffBuilder buildDisplayPatchFrom: oldCodeString to: newCodeString))
  				openLabel: 'Decompilation Differences for ', cls name,'>>',selector"
  		 "(StringHolder new textContents:
  			(TextDiffBuilder buildDisplayPatchFrom: oldMethod abstractSymbolic to: newMethod abstractSymbolic))
  				openLabel: 'Bytecode Differences for ', cls name,'>>',selector"
  		 self assert: oldCodeString = newCodeString
  			description: cls name asString, ' ', selector asString
  			resumable: true]!

Item was changed:
  ----- Method: MCStWriterTest>>assertChunkIsWellFormed: (in category 'asserting') -----
  assertChunkIsWellFormed: chunk
+ 	self class newParser
- 	self class parserClass new
  		parse: chunk readStream 
  		class: UndefinedObject 
  		noPattern: true
  		context: nil
  		notifying: nil
  		ifFail: [self assert: false]!

Item was changed:
  ----- Method: MCStWriterTest>>assertMethodChunkIsWellFormed: (in category 'asserting') -----
  assertMethodChunkIsWellFormed: chunk
+ 	self class newParser
- 	self class parserClass new
  		parse: chunk readStream 
  		class: UndefinedObject 
  		noPattern: false
  		context: nil
  		notifying: nil
  		ifFail: [self assert: false]!




More information about the Squeak-dev mailing list