New Win32 VM (3.10.3)

"Martin v. Löwis" martin at v.loewis.de
Tue Jun 5 17:33:33 UTC 2007


> I'm looking forward to someone explaining to me how to write unit tests
> that test the file system encodings and clipboard interface in a
> meaningful way. If these tests are any good, they should fail on a 3.9.x
> VM and pass on 3.10.3 but I have no idea how to write such a test.

It might be possible to escape to VBScript or JScript to achieve that;
I would hope (but am unsure) that the VBScript interpreter supports
non-CP_ACP filenames. So you would generate a VBScript program on the
fly, run it, and thus create a few interesting files.

To get you started: ChrW() is a function that creates a Unicode
character given its ordinal, and the sequence

dim filesys, filetxt, getname, path
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.CreateTextFile("c:\somefile.txt", True)
filetxt.WriteLine("Your text goes here.")
filetxt.Close

should create a file named somefile.txt.

I read that neither wsh.exe nor csh.exe (the scripting hosts for
VB, in windowing or command-line mode) cannot do clipboard
IO, so you use MSIE for that:

Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate("about:blank")
strURL = objIE.document.parentwindow.clipboardData.GetData("text")
objIE.Quit

To put data to the clipboard, do

objIE.document.parentwindow.clipboardData.SetData "text", "Hello This Is
A Test"

HTH,
Martin



More information about the Squeak-dev mailing list