[Pkg] The Trunk: Tests-eem.378.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jun 6 23:55:53 UTC 2017


Eliot Miranda uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-eem.378.mcz

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

Name: Tests-eem.378
Author: eem
Time: 6 June 2017, 4:55:37.684864 pm
UUID: afb463b0-6dc8-4824-a3c1-e4061320096c
Ancestors: Tests-eem.377

Harvest UnixFileDirectoryTests>>testCheckNameFixErrors from Terf.

=============== Diff against Tests-eem.377 ===============

Item was added:
+ TestCase subclass: #UnixFileDirectoryTests
+ 	instanceVariableNames: ''
+ 	classVariableNames: ''
+ 	poolDictionaries: ''
+ 	category: 'Tests-Files'!
+ 
+ !UnixFileDirectoryTests commentStamp: 'bobw 7/27/2010 09:08' prior: 0!
+ Just some simply unit tests for UnixFileDirectory
+ 
+ Instance Variables:
+ !

Item was added:
+ ----- Method: UnixFileDirectoryTests>>testCheckNameFixErrors (in category 'testing') -----
+ testCheckNameFixErrors
+ 
+ 	| directory bigName maxLength |
+ 	"Do not use #on:, it will use the default directory class, which 
+ 	 might be different on this platform."
+ 	directory := UnixFileDirectory new setPathName: '.'.
+ 	self assert: ('abc' = (directory checkName: 'abc' fixErrors: false)).
+ 	self assert: ('abc' = (directory checkName: 'abc' fixErrors: true)).
+ 	
+ 	"These test the superclass implementation."
+ 	self should: [directory checkName: '' fixErrors: false] raise: Error.
+ 	self should: [directory checkName: '' fixErrors: true] raise: Error.
+ 	maxLength := directory class maxFileNameLength.
+ 	bigName := String streamContents: [:s | maxLength + 1 timesRepeat: [s nextPut: $1]].
+ 	self should: [directory checkName: bigName fixErrors: false] raise: Error.
+ 	"#contractTo: seems a little odd, but it is what #checkName:fixErrors: uses"
+ 	self assert: ((bigName contractTo: maxLength)  = (directory checkName: bigName fixErrors: true)).
+ 	
+ 	"UnixFileDirectory specific tests"
+ 	"UnixFileDirectory will turn / into #, if told to fix errors."
+ 	self assert: ('a#b#c' = (directory checkName: 'a/b/c' fixErrors: true)).
+ 	"And it will raise an error if it does not fix errors."
+ 	self should: [(directory checkName: 'a/b/c' fixErrors: false)] raise: Error!



More information about the Packages mailing list