branch: externals/csharp-mode commit 15bc3cbd5979ee5c0592b8d6d2f53d61ebfb5491 Author: Jostein Kjønigsen <jost...@kjonigsen.net> Commit: Jostein Kjønigsen <jost...@kjonigsen.net>
Add support for dotnet test failures. --- csharp-mode-tests.el | 4 +++- csharp-mode.el | 11 ++++++++++- test-files/dotnet-test-fail-xunit.txt | 8 ++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el index 0cf3309..1bf7b47 100644 --- a/csharp-mode-tests.el +++ b/csharp-mode-tests.el @@ -242,7 +242,9 @@ ("./test-files/dotnet-nuget-error.txt" ,csharp-compilation-re-dotnet-error ("/home/jostein/build/sample-app/sample-app.csproj")) ("./test-files/dotnet-nuget-warning.txt" ,csharp-compilation-re-dotnet-warning - ("/home/jostein/build/sample-app/sample-app.csproj")))) + ("/home/jostein/build/sample-app/sample-app.csproj")) + ("./test-files/dotnet-test-fail-xunit.txt" ,csharp-compilation-re-dotnet-testfail + ("/home/jostein/build/sample-app/Module/Testee.cs")))) (let* ((file-name (car test-case)) (regexp (cadr test-case)) diff --git a/csharp-mode.el b/csharp-mode.el index 2a14bd3..50357c2 100644 --- a/csharp-mode.el +++ b/csharp-mode.el @@ -376,6 +376,12 @@ casts and declarations are fontified. Used on level 2 and higher." (defconst csharp-compilation-re-dotnet-warning "\\([^\r\n]+\\) : warning [A-Z]+[0-9]+:") +(defconst csharp-compilation-re-dotnet-testfail + (concat + "\\[[A-Za-z.]+[[:blank:]]+[0-9]+:[0-9]+:[0-9]+.[0-9]+\\][^(\r\n)]+ \\[FAIL\\]\n" + "[[:blank:]]+X \\(?:.+\n\\)+" + "[[:blank:]]+Stack Trace:\n" + "[[:blank:]]+at [^\r\n]+ in \\([^\r\n]+\\):line \\([0-9]+\\)")) (eval-after-load 'compile (lambda () @@ -410,7 +416,10 @@ casts and declarations are fontified. Used on level 2 and higher." 1) (dotnet-warning ,csharp-compilation-re-dotnet-warning - 1 nil nil 1))) + 1 nil nil 1) + (dotnet-testfail + ,csharp-compilation-re-dotnet-testfail + 1 2))) (add-to-list 'compilation-error-regexp-alist-alist regexp) (add-to-list 'compilation-error-regexp-alist (car regexp))))) diff --git a/test-files/dotnet-test-fail-xunit.txt b/test-files/dotnet-test-fail-xunit.txt new file mode 100644 index 0000000..930308d --- /dev/null +++ b/test-files/dotnet-test-fail-xunit.txt @@ -0,0 +1,8 @@ +[xUnit.net 00:00:00.60] SampleApp.Module.Tests.TestClass.Some_Testcase_Gone_Wrong [FAIL] + X SampleApp.Module.Tests.TestClass.Some_Testcase_Gone_Wrong [2ms] + Error Message: + System.NotImplementedException : The method or operation is not implemented. + Stack Trace: + at SampleApp.Module.Testee..ctor(IHttpClient httpClient) in /home/jostein/build/sample-app/Module/Testee.cs:line 24 + at SampleApp.Module.Tests.TestClass.Some_Testcase_Gone_Wrong() in /home/jostein/build/sample-app/tests/TestClass.cs:line 11 +