<> <> <> <> <<>> DIRECTORY Basics, BasicTime, Commander, ComputeServerControl, FS, List, IO, ProcessProps, Rope; TestFeaturesImpl: CEDAR PROGRAM IMPORTS ComputeServerControl, FS, List, IO, ProcessProps, Rope = BEGIN <> STREAM: TYPE = IO.STREAM; ROPE: TYPE = Rope.ROPE; <> testFeatures1: Commander.CommandProc = { in: STREAM = cmd.in; out: STREAM = cmd.out; err: STREAM = cmd.err; commandLine: ROPE _ cmd.commandLine; startWDIR, setToWDIR, tempRope: ROPE; addWDir: List.AList; fullFName, attachedTo: ROPE; keep: CARDINAL; bytes: INT; created: BasicTime.GMT; smallFileToCat: STREAM; testExpandNameWithProcessProps: PROC [] = { [fullFName: tempRope] _ FS.ExpandName[name: "foo.mesa"]; }; enumInfo: FS.InfoProc = { out.PutL[LIST [ IO.rope["\n\t"], IO.rope[fullFName], IO.rope["\n\t\t"], IO.rope[attachedTo], IO.char[' ], IO.card[keep], IO.char[' ], IO.int[bytes], IO.char[' ], IO.time[created]]]; RETURN[TRUE]; }; enumInfoONCE: FS.InfoProc = { out.PutL[LIST [ IO.rope["\n\t"], IO.rope[fullFName], IO.rope["\n\t\t"], IO.rope[attachedTo], IO.char[' ], IO.card[keep], IO.char[' ], IO.int[bytes], IO.char[' ], IO.time[created]]]; RETURN[FALSE]; }; enumInfoNEVER: FS.InfoProc = { out.Put[IO.rope[" SHOULD NOT GET HERE"]]; RETURN[FALSE]; }; enumName: FS.NameProc = { out.PutL[LIST [ IO.rope["\n\t"], IO.rope[fullFName]]]; RETURN[TRUE]; }; enumNameONCE: FS.NameProc = { out.PutL[LIST [ IO.rope["\n\t"], IO.rope[fullFName]]]; RETURN[FALSE]; }; enumNameNEVER: FS.NameProc = { out.Put[IO.rope[" SHOULD NOT GET HERE"]]; RETURN[FALSE]; }; <> out.Put[IO.rope[ " command line: "]]; out.Put[IO.rope[commandLine]]; <> startWDIR _ FS.GetDefaultWDir[]; FS.SetDefaultWDir["users/hagmann.pa/Summoner/"]; setToWDIR _ FS.GetDefaultWDir[]; FS.SetDefaultWDir[startWDIR]; out.Put[IO.rope[" WDIR before and after SetDefaultWDir: "]]; out.Put[IO.rope[startWDIR]]; out.PutChar[' ]; out.Put[IO.rope[setToWDIR]]; IF Rope.Equal[startWDIR, "[]<>"] THEN FS.SetDefaultWDir["[]<>Summoner>"]; [fullFName: tempRope] _ FS.ExpandName[name: "///foo.mesa"]; out.Put[IO.rope[" ExpandName tests - ///foo.mesa: "], IO.rope[tempRope]]; [fullFName: tempRope] _ FS.ExpandName[name: "foo.mesa"]; out.Put[IO.rope[" ExpandName tests - foo.mesa, NIL: "], IO.rope[tempRope]]; addWDir _ List.PutAssoc[key: $WorkingDirectory , val: NARROW["///fi/", ROPE], aList: NIL]; ProcessProps.AddPropList[propList: addWDir, inner: testExpandNameWithProcessProps]; out.Put[IO.rope[" ExpandName tests - foo.mesa, NIL, ProcessProp = ///fi/: "], IO.rope[tempRope]]; [fullFName: tempRope] _ FS.ExpandName[name: "foo.mesa", wDir: "///fum/"]; out.Put[IO.rope[" ExpandName tests - foo.mesa, ///fum/: "], IO.rope[tempRope]]; tempRope _ FS.ConstructFName[ ["one", "two", "three", "four", "five", "six"], FALSE]; out.Put[IO.rope[" ConstructFName test - one through six: "], IO.rope[tempRope]]; out.Put[IO.rope[" WordsForPages for one page: "], IO.int[FS.WordsForPages[1]]]; [fullFName, attachedTo, keep, bytes, created] _ FS.FileInfo[name: "FS.bcd", wantedCreatedTime: BasicTime.nullGMT, remoteCheck: TRUE, wDir: "///Summoner/"] ; out.PutL[LIST [ IO.rope[" FileInfo for FS.bcd, TRUE, ///Summoner/: "], IO.rope[fullFName], IO.rope["\n\t"], IO.rope[attachedTo], IO.char[' ], IO.card[keep], IO.char[' ], IO.int[bytes], IO.char[' ], IO.time[created]]]; out.Put[IO.rope[" EnumerateForInfo for FSInterface*!h, ///Summoner/: "]]; FS.EnumerateForInfo[pattern: "FSInterface*!h", proc: enumInfo, wDir: "///Summoner/"]; out.Put[IO.rope[" EnumerateForInfo for FSInterface*!h, ///Summoner/ - ONCE-: "]]; FS.EnumerateForInfo[pattern: "FSInterface*!h", proc: enumInfoONCE, wDir: "///Summoner/"]; FS.EnumerateForInfo[pattern: "FSInterface.nosuchfile!h", proc: enumInfoNEVER, wDir: "///Summoner/"]; out.Put[IO.rope[" EnumerateForInfo for a non-existant file"]]; out.Put[IO.rope[" EnumerateForNames for FSInterface*!h, ///Summoner/: "]]; FS.EnumerateForNames[pattern: "FSInterface*!h", proc: enumName, wDir: "///Summoner/"]; out.Put[IO.rope[" EnumerateForNames for FSInterface*!h, ///Summoner/ - ONCE-: "]]; FS.EnumerateForNames[pattern: "FSInterface*!h", proc: enumNameONCE, wDir: "///Summoner/"]; FS.EnumerateForNames[pattern: "FSInterface.nosuchfile!h", proc: enumNameNEVER, wDir: "///Summoner/"]; out.Put[IO.rope[" EnumerateForNames for a non-existant file"]]; smallFileToCat _ FS.StreamOpen["smallFileToCat.txt"]; out.Put[IO.rope[" Type smallFileToCat on stdout "]]; DO out.PutChar[smallFileToCat.GetChar[! IO.EndOfStream => EXIT]]; ENDLOOP; out.Put[IO.rope[" The first half of the tests are all done "]]; }; ComputeServerControl.Register[key: "SummonerTestFeatures1", version: "1", proc: testFeatures1, doc: NIL, clientData: NIL]; END. <> <> <<>>