@@ -48,29 +48,27 @@ let tests =
48
48
stdErr.Trim() |> Expect.equal " empty exected" " "
49
49
50
50
testCase " simple failed to compile" <| fun _ ->
51
- try
52
- fakeRunAndCheck " fail-to-compile.fsx" " fail-to-compile.fsx" " core-simple-failed-to-compile" |> ignProc
53
- fail " Expected an compilation error and a nonzero exit code!"
54
- with
55
- | FakeExecutionFailed( result) ->
56
- let stdOut = String.Join( " \n " , result.Messages)
57
- let stdErr = String.Join( " \n " , result.Errors)
58
- stdErr.Contains( " klajsdhgfasjkhd" )
59
- |> Expect.isTrue ( sprintf " Standard Error Output should contain 'klajsdhgfasjkhd', but was: '%s ', Out: '%s '" stdErr stdOut)
51
+ let result =
52
+ expectFailure " Expected an compilation error and a nonzero exit code!" ( fun _ ->
53
+ fakeRunAndCheck " fail-to-compile.fsx" " fail-to-compile.fsx" " core-simple-failed-to-compile" |> ignProc)
54
+
55
+ let stdOut = String.Join( " \n " , result.Messages)
56
+ let stdErr = String.Join( " \n " , result.Errors)
57
+ stdErr.Contains( " klajsdhgfasjkhd" )
58
+ |> Expect.isTrue ( sprintf " Standard Error Output should contain 'klajsdhgfasjkhd', but was: '%s ', Out: '%s '" stdErr stdOut)
60
59
61
- checkIntellisense " fail-to-compile.fsx" " core-simple-failed-to-compile"
60
+ checkIntellisense " fail-to-compile.fsx" " core-simple-failed-to-compile"
62
61
63
62
testCase " simple runtime error" <| fun _ ->
64
- try
65
- fakeRunAndCheck " runtime-error.fsx" " runtime-error.fsx" " core-simple-runtime-error" |> ignProc
66
- fail " Expected an runtime error and a nonzero exit code!"
67
- with
68
- | FakeExecutionFailed( result) ->
69
- let stdOut = String.Join( " \n " , result.Messages)
70
- let stdErr = String.Join( " \n " , result.Errors)
71
- stdErr.Contains( " runtime error" )
72
- |> Expect.isTrue ( sprintf " Standard Error Output should contain 'runtime error', but was: '%s ', Out: '%s '" stdErr stdOut)
73
- checkIntellisense " runtime-error.fsx" " core-simple-runtime-error"
63
+ let result =
64
+ expectFailure " Expected an runtime error and a nonzero exit code!" ( fun _ ->
65
+ fakeRunAndCheck " runtime-error.fsx" " runtime-error.fsx" " core-simple-runtime-error" |> ignProc)
66
+
67
+ let stdOut = String.Join( " \n " , result.Messages)
68
+ let stdErr = String.Join( " \n " , result.Errors)
69
+ stdErr.Contains( " runtime error" )
70
+ |> Expect.isTrue ( sprintf " Standard Error Output should contain 'runtime error', but was: '%s ', Out: '%s '" stdErr stdOut)
71
+ checkIntellisense " runtime-error.fsx" " core-simple-runtime-error"
74
72
75
73
testCase " reference fake runtime" <| fun _ ->
76
74
handleAndFormat <| fun () ->
@@ -155,6 +153,30 @@ let tests =
155
153
fakeRunAndCheckInPath " build.fsx" " build.fsx" " i002025" " script" |> ignProc
156
154
157
155
testCase " issue #2007 - native libs work" <| fun _ ->
156
+ // should "just" work
158
157
handleAndFormat <| fun () ->
159
- fakeRunAndCheck " build.fsx" " build.fsx" " i002007-native-libs" |> ignore
158
+ fakeRunAndCheck " build.fsx" " build.fsx" " i002007-native-libs" |> ignProc
159
+
160
+ // Should tell FAKE error story
161
+ let result =
162
+ expectFailure " Expected missing entrypoint error" <| fun () ->
163
+ directFake ( sprintf " run build.fsx -t FailWithMissingEntry" ) " i002007-native-libs" |> ignProc
164
+ let stdOut = String.Join( " \n " , result.Messages) .Trim()
165
+ let stdErr = String.Join( " \n " , result.Errors)
166
+ ( stdErr.Contains " Fake_ShouldNotExistExtryPoint" && stdErr.Contains " EntryPointNotFoundException:" )
167
+ |> Expect.isTrue ( sprintf " Standard Error Output should contain 'Fake_ShouldNotExistExtryPoint' and 'EntryPointNotFoundException:', but was: '%s ', Out: '%s '" stdErr stdOut)
168
+
169
+ let result =
170
+ expectFailure " Expected missing entrypoint error" <| fun () ->
171
+ directFake ( sprintf " run build.fsx -t FailWithUnknown" ) " i002007-native-libs" |> ignProc
172
+ let stdOut = String.Join( " \n " , result.Messages) .Trim()
173
+ let stdErr = String.Join( " \n " , result.Errors)
174
+ ( stdErr.Contains " unknown_dependency.dll" && stdErr.Contains " DllNotFoundException:" )
175
+ |> Expect.isTrue ( sprintf " Standard Error Output should contain 'unknown_dependency.dll' and 'DllNotFoundException:', but was: '%s ', Out: '%s '" stdErr stdOut)
176
+ // TODO: enable instead of the above
177
+ //stdErr.Contains("Could not resolve native library 'unknown_dependency.dll'")
178
+ // |> Expect.isTrue (sprintf "Standard Error Output should contain \"Could not resolve native library 'unknown_dependency.dll'\", but was: '%s', Out: '%s'" stdErr stdOut)
179
+ //stdErr.Contains("This can happen for various reasons")
180
+ // |> Expect.isTrue (sprintf "Standard Error Output should contain \"This can happen for various reasons\", but was: '%s', Out: '%s'" stdErr stdOut)
181
+
160
182
]
0 commit comments