[Pkg] Rio: File-Test-kph.10.mcz
squeak-dev-noreply at lists.squeakfoundation.org
squeak-dev-noreply at lists.squeakfoundation.org
Mon Mar 2 04:43:50 UTC 2009
A new version of File-Test was added to project Rio:
http://www.squeaksource.com/Rio/File-Test-kph.10.mcz
==================== Summary ====================
Name: File-Test-kph.10
Author: kph
Time: 2 March 2009, 4:43:46 am
UUID: b74c0909-06e4-11de-a0af-000a95edb42a
Ancestors: File-Test-kph.9
+ Better instanciation code all round
+ handle line endings
- all but one working on unix/macosx
- 20+ failures/errors on win
=============== Diff against File-Test-kph.9 ===============
Item was added:
+ ----- Method: FileVirtualFSCommonTest>>localExecutiveClass (in category 'fixtures') -----
+ localExecutiveClass
+
+ self subclassResponsibility!
Item was changed:
----- Method: FileVirtualFSDosFileTest>>testLinearRelativeTo (in category 'tests') -----
testLinearRelativeTo
file := fileClass new: 'E:\hello\this\is\a\world\apart\from\here.txt'.
file := file linearRelativeTo: (fileClass new: 'E:\hello\this').
self assert: (file = 'is\a\world\apart\from\here.txt').
!
Item was added:
+ ----- Method: FileVirtualFSDosKernelTest>>localExecutiveClass (in category 'fixture') -----
+ localExecutiveClass
+
+ ^ FileVirtualTestFSDos !
Item was changed:
----- Method: FileVirtualFSUnixFileTest>>setUp (in category 'fixture') -----
setUp
fileClass := File.
dirClass := Directory.
+
+ super setUp.!
-
- FileLocalExecutive testFileSystem: FileVirtualTestFSUnix new.
-
- !
Item was added:
+ ----- Method: FileVirtualFSUnixKernelTest>>localExecutiveClass (in category 'fixture') -----
+ localExecutiveClass
+
+ ^ FileVirtualTestFSUnix!
Item was added:
+ ----- Method: FileVirtualFSCommonTest>>setUp (in category 'tests-string behaviour') -----
+ setUp
+
+ self localExecutive initializeDefault!
Item was changed:
----- Method: FileModeTests>>fixture: (in category 'fixtures') -----
fixture: lineEnding
+ file := (self useTestDir / 'crlf') binary contents: 'hello' , lineEnding , 'world'.
- file := (self useTestDir / 'crlf') contents: 'hello' , lineEnding , 'world'.
!
Item was added:
+ ----- Method: FileKernelTest>>testNew (in category 'tests-standard') -----
+ testNew
+ self should: [ FileKernel new ] raise: Error.
+ !
Item was changed:
----- Method: FileVirtualFSUnixKernelTest>>setUp (in category 'fixture') -----
setUp
fileClass := dirClass := FileKernel.
+
+ super setUp.!
- FileLocalExecutive testFileSystem: FileVirtualTestFSUnix new.
-
- !
Item was changed:
----- Method: FileVirtualFSCommonTest>>dirClass (in category 'as yet unclassified') -----
dirClass
+
-
^ dirClass!
Item was changed:
----- Method: FileTest>>testFtp (in category 'tests') -----
testFtp
+ self should: [ File new: 'ftp://ftp.seasidehosting.st' ] raise: Error.
+
+ file := Directory new: 'ftp://ftp.seasidehosting.st'.
+
- file := File new: 'ftp://ftp.seasidehosting.st'.
self assert: file class = Directory.
self assert: file executive class = FileFtpExecutive.!
Item was added:
+ ----- Method: FileVirtualFSCommonTest>>localExecutive (in category 'fixtures') -----
+ localExecutive
+
+ ^ localExecutive ifNil: [ localExecutive := self localExecutiveClass new ].
+
+ !
Item was changed:
----- Method: FileKernelTest>>rootIsDirectory (in category 'tests-standard') -----
rootIsDirectory
+ dir := fileClass localExecutive root.
- dir := fileClass new: FileLocalExecutive current root value.
+
self assert: (dir isRoot).
self assert: (dir isDirectory).
!
Item was changed:
----- Method: FileDirTest>>initialize (in category 'fixtures') -----
initialize
+ testDir := Directory cwd / 'testing_file'.
+ destDir := Directory cwd / 'testing_file_dest'.!
- testDir := Cwd / 'testing_file'.
- destDir := Cwd / 'testing_file_dest'.!
Item was changed:
----- Method: FileVirtualFSDosKernelTest>>setUp (in category 'fixture') -----
setUp
fileClass := dirClass := FileKernel.
+ super setUp.!
- FileLocalExecutive testFileSystem: FileVirtualTestFSDos new.
-
- !
Item was changed:
----- Method: FileTest>>testFileAppendString (in category 'tests') -----
testFileAppendString
+ self testDirFromString.
+ newFile := dir / 'user'.
- self testFileFromString.
- newFile := file / 'user'.
self deny: newFile == file.
self assert: newFile = '/home/user'!
Item was changed:
----- Method: FileVirtualTestFSUnix>>dirClass (in category 'as yet unclassified') -----
dirClass
^ Notification new tag: #dirClass; signal!
Item was added:
+ ----- Method: FileTest>>testNew (in category 'tests') -----
+ testNew
+ self should: [ File new ] raise: Error.
+ !
Item was changed:
----- Method: FileTest>>testCwdAppendString (in category 'tests') -----
testCwdAppendString
| file2 |
+ dir := Directory new.
+ file2 := dir / 'user'.
- file := File new.
- file2 := file / 'user'.
self deny: file2 == file.
self assert: file2 asString = 'user'!
Item was added:
+ ----- Method: FileTest>>testDirFromString (in category 'tests') -----
+ testDirFromString
+ dir := Directory new: '/home'.
+ self assert: dir = '/home'!
Item was changed:
----- Method: FileTest>>testExists (in category 'tests') -----
testExists
self assert: self thisImage exists.
self assert: self thisImage parent exists.
+ self assert: (File new: (self thisImage fileName)) exists.
+ self deny: (self thisImage parent / 'blah') exists.
+ self deny: (File new: 'blah') exists!
- self deny: (self thisImage / 'blah') exists!
Item was changed:
----- Method: FileTest>>testHttp (in category 'tests') -----
testHttp
+ self should: [ File new: 'http://www.google.com' ] raise: Error.
+ dir := Directory new: 'http://www.google.com'.
+ self assert: dir class = Directory.
+ self assert: dir executive class = FileHttpExecutive.
+
+ file := File new: 'http://www.google.com/index.html'.
+
+ self assert: file class = File.
- file := File new: 'http://www.google.com'.
- self assert: file class = Directory.
self assert: file executive class = FileHttpExecutive!
Item was changed:
TestCase subclass: #FileVirtualFSCommonTest
+ instanceVariableNames: 'file fileClass dirClass localExecutive'
- instanceVariableNames: 'file fileClass dirClass'
classVariableNames: ''
poolDictionaries: ''
category: 'File-Test'!
Item was changed:
----- Method: FileVirtualFSCommonTest>>runCaseWith: (in category 'as yet unclassified') -----
runCaseWith: aBlock
+ [ self localExecutive pretendDuring: aBlock ] on: Notification do: [ :ex | ex resume: (self perform: ex tag) ]!
- aBlock on: Notification do: [ :ex | ex resume: (self perform: ex tag) ]!
Item was changed:
----- Method: FileDirTest>>testAddFile (in category 'tests-directory copying') -----
testAddFile
| result |
self makeDirectoriesAndFiles.
+ result := destDir mkpath add: (testDir / 't_a' / 'f 1') asFile.
- result := destDir mkpath add: (testDir / 't_a' / 'f 1').
+ self assert: (destDir all entries size = 1).
- self assert: (destDir all entries size = 1).
!
Item was added:
+ ----- Method: FileVirtualTestFSUnix>>checkVoted: (in category 'as yet unclassified') -----
+ checkVoted: voted
+
+ "alternative local executives may override this to rig the voting"
+
+ "we rig the voting so we win if the winner is the executive we are spoofing"
+
+ ^ voted = self class superclass ifTrue: [ ^ self class ] ifFalse: [ voted ]
+ !
Item was added:
+ ----- Method: FileTest>>testPlusExtend (in category 'tests') -----
+ testPlusExtend
+ self testFileFromString.
+ newFile := file + '.dir'.
+ self deny: newFile == file.
+ self assert: newFile = '/home.dir'!
Item was added:
+ ----- Method: FileVirtualTestFSDos>>checkVoted: (in category 'as yet unclassified') -----
+ checkVoted: voted
+
+ "alternative local executives may override this to rig the voting"
+
+ "we rig the voting so we win if the winner is the executive we are spoofing"
+
+ ^ voted = self class superclass ifTrue: [ ^ self class ] ifFalse: [ voted ]
+ !
Item was changed:
----- Method: FileVirtualFSCommonTest>>currentFileSystem (in category 'fixtures') -----
currentFileSystem
+ ^ FileKernel localExecutive!
- ^ FileLocalExecutive current!
Item was changed:
----- Method: FileModeTests>>testReadingCrLf (in category 'fixtures') -----
testReadingCrLf
"
self debug: #testReadingCrLf.
"
+ | m |
self fixture: String crlf.
+
+ file asciiCrLf.
file reader: [ :r |
+ self assert: ((m := r nextLine) = 'hello').
+ self assert: ((m := r nextLine) = 'world').
- self assert: (r nextLine = 'hello').
- self assert: (r nextLine = 'world').
self assert: r atEnd.
].!
Item was added:
+ ----- Method: FileDirTest>>testNew (in category 'tests-directory copying') -----
+ testNew
+ self assert: (Directory new asString = '').
+ self assert: (Directory new class = Directory).
+ self assert: (Directory new exists).
+
+
+
+
+ !
Item was changed:
----- Method: FileVirtualFSDosFileTest>>setUp (in category 'fixture') -----
setUp
fileClass := File.
dirClass := Directory.
+ super setUp.!
- FileLocalExecutive testFileSystem: FileVirtualTestFSDos new.
-
- !
Item was removed:
- ----- Method: FileVirtualFSCommonTest>>tearDown (in category 'fixtures') -----
- tearDown
-
- FileLocalExecutive testEnd!
Item was removed:
- ----- Method: FileVirtualTestFSDos>>dirClass (in category 'as yet unclassified') -----
- dirClass
-
- ^ Notification new tag: #dirClass; signal!
Item was removed:
- ----- Method: FileVirtualTestFSDos>>fileClass (in category 'as yet unclassified') -----
- fileClass
-
- ^ Notification new tag: #fileClass; signal!
Item was removed:
- ----- Method: FileVirtualTestFSUnix>>initialize (in category 'as yet unclassified') -----
- initialize
-
- self initializeDefault!
Item was removed:
- ----- Method: FileVirtualTestFSDos>>initialize (in category 'as yet unclassified') -----
- initialize
-
- self initializeDefault!
Item was removed:
- ----- Method: FileTest>>testRioExtend (in category 'tests') -----
- testRioExtend
- self testFileFromString.
- newFile := file + '.dir'.
- self deny: newFile == file.
- self assert: newFile = '/home.dir'!
More information about the Packages
mailing list