mirror of
https://github.com/Smaug123/WoofWare.Expect
synced 2025-10-08 22:08:38 +00:00
Compare commits
1 Commits
WoofWare.E
...
ad05a9c106
Author | SHA1 | Date | |
---|---|---|---|
|
ad05a9c106 |
@@ -61,6 +61,7 @@ module TestDot =
|
|||||||
|
|
||||||
let mutable started = false
|
let mutable started = false
|
||||||
let mutable waited = false
|
let mutable waited = false
|
||||||
|
let mutable exitCodeObserved = false
|
||||||
let mutable disposed = false
|
let mutable disposed = false
|
||||||
|
|
||||||
let expected =
|
let expected =
|
||||||
@@ -84,7 +85,7 @@ module TestDot =
|
|||||||
member _.Create exe args =
|
member _.Create exe args =
|
||||||
exe |> shouldEqual "graph-easy"
|
exe |> shouldEqual "graph-easy"
|
||||||
|
|
||||||
args.StartsWith ("--as=boxarg --from=dot ", StringComparison.Ordinal)
|
args.StartsWith ("--as=boxart --from=dot ", StringComparison.Ordinal)
|
||||||
|> shouldEqual true
|
|> shouldEqual true
|
||||||
|
|
||||||
{ new IDisposable with
|
{ new IDisposable with
|
||||||
@@ -93,6 +94,10 @@ module TestDot =
|
|||||||
|
|
||||||
member _.WaitForExit p = waited <- true
|
member _.WaitForExit p = waited <- true
|
||||||
member _.ReadStandardOutput _ = expected
|
member _.ReadStandardOutput _ = expected
|
||||||
|
|
||||||
|
member _.ExitCode _ =
|
||||||
|
exitCodeObserved <- true
|
||||||
|
0
|
||||||
}
|
}
|
||||||
|
|
||||||
Dot.render' pr (toFs fs) "graph-easy" contents
|
Dot.render' pr (toFs fs) "graph-easy" contents
|
||||||
@@ -101,4 +106,5 @@ module TestDot =
|
|||||||
|
|
||||||
started |> shouldEqual true
|
started |> shouldEqual true
|
||||||
waited |> shouldEqual true
|
waited |> shouldEqual true
|
||||||
|
exitCodeObserved |> shouldEqual true
|
||||||
disposed |> shouldEqual true
|
disposed |> shouldEqual true
|
||||||
|
@@ -17,6 +17,8 @@ module Dot =
|
|||||||
abstract WaitForExit : 'Process -> unit
|
abstract WaitForExit : 'Process -> unit
|
||||||
/// Equivalent to Process.StandardOutput.ReadToEnd
|
/// Equivalent to Process.StandardOutput.ReadToEnd
|
||||||
abstract ReadStandardOutput : 'Process -> string
|
abstract ReadStandardOutput : 'Process -> string
|
||||||
|
/// Equivalent to Process.ExitCode
|
||||||
|
abstract ExitCode : 'Process -> int
|
||||||
|
|
||||||
/// The real Process interface, in a form that can be passed to `render'`.
|
/// The real Process interface, in a form that can be passed to `render'`.
|
||||||
let process' =
|
let process' =
|
||||||
@@ -32,6 +34,7 @@ module Dot =
|
|||||||
member _.Start p = p.Start ()
|
member _.Start p = p.Start ()
|
||||||
member _.WaitForExit p = p.WaitForExit ()
|
member _.WaitForExit p = p.WaitForExit ()
|
||||||
member _.ReadStandardOutput p = p.StandardOutput.ReadToEnd ()
|
member _.ReadStandardOutput p = p.StandardOutput.ReadToEnd ()
|
||||||
|
member _.ExitCode p = p.ExitCode
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A mock for System.IO
|
/// A mock for System.IO
|
||||||
@@ -66,11 +69,17 @@ module Dot =
|
|||||||
try
|
try
|
||||||
fs.WriteFile tempFile dotFileContents
|
fs.WriteFile tempFile dotFileContents
|
||||||
|
|
||||||
use p = pr.Create graphEasyExecutable ("--as=boxarg --from=dot " + tempFile)
|
use p = pr.Create graphEasyExecutable ("--as=boxart --from=dot " + tempFile)
|
||||||
pr.Start p |> ignore<bool>
|
pr.Start p |> ignore<bool>
|
||||||
pr.WaitForExit p
|
pr.WaitForExit p
|
||||||
|
|
||||||
"\n" + pr.ReadStandardOutput p
|
let stdout = pr.ReadStandardOutput p
|
||||||
|
let exitCode = pr.ExitCode p
|
||||||
|
|
||||||
|
if exitCode <> 0 then
|
||||||
|
failwithf "failed to run; exit code: %i. stdout:\n%s" exitCode stdout
|
||||||
|
|
||||||
|
"\n" + stdout
|
||||||
finally
|
finally
|
||||||
try
|
try
|
||||||
fs.DeleteFile tempFile
|
fs.DeleteFile tempFile
|
||||||
|
@@ -55,8 +55,9 @@ WoofWare.Expect.Dot+IFileSystem - interface with 3 member(s)
|
|||||||
WoofWare.Expect.Dot+IFileSystem.DeleteFile [method]: string -> unit
|
WoofWare.Expect.Dot+IFileSystem.DeleteFile [method]: string -> unit
|
||||||
WoofWare.Expect.Dot+IFileSystem.GetTempFileName [method]: unit -> string
|
WoofWare.Expect.Dot+IFileSystem.GetTempFileName [method]: unit -> string
|
||||||
WoofWare.Expect.Dot+IFileSystem.WriteFile [method]: string -> string -> unit
|
WoofWare.Expect.Dot+IFileSystem.WriteFile [method]: string -> string -> unit
|
||||||
WoofWare.Expect.Dot+IProcess`1 - interface with 4 member(s)
|
WoofWare.Expect.Dot+IProcess`1 - interface with 5 member(s)
|
||||||
WoofWare.Expect.Dot+IProcess`1.Create [method]: string -> string -> #(IDisposable)
|
WoofWare.Expect.Dot+IProcess`1.Create [method]: string -> string -> #(IDisposable)
|
||||||
|
WoofWare.Expect.Dot+IProcess`1.ExitCode [method]: #(IDisposable) -> int
|
||||||
WoofWare.Expect.Dot+IProcess`1.ReadStandardOutput [method]: #(IDisposable) -> string
|
WoofWare.Expect.Dot+IProcess`1.ReadStandardOutput [method]: #(IDisposable) -> string
|
||||||
WoofWare.Expect.Dot+IProcess`1.Start [method]: #(IDisposable) -> bool
|
WoofWare.Expect.Dot+IProcess`1.Start [method]: #(IDisposable) -> bool
|
||||||
WoofWare.Expect.Dot+IProcess`1.WaitForExit [method]: #(IDisposable) -> unit
|
WoofWare.Expect.Dot+IProcess`1.WaitForExit [method]: #(IDisposable) -> unit
|
||||||
|
Reference in New Issue
Block a user