forked from dominikh/go-mode.el
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ‘go-test’ compilation message pattern.
Fixes dominikh#361, dominikh#362 Restrict the prefix and filename pattern (Bug dominikh#361), and also allow for a test name prefix (Bug dominikh#362). Add regression tests for these bugs.
- Loading branch information
Showing
2 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
;;; go-compile-test.el --- unit tests for ‘go-mode’ compilation -*- lexical-binding: t; -*- | ||
|
||
;; Copyright 2020 Google LLC | ||
;; | ||
;; Licensed under the Apache License, Version 2.0 (the "License"); | ||
;; you may not use this file except in compliance with the License. | ||
;; You may obtain a copy of the License at | ||
;; | ||
;; https://www.apache.org/licenses/LICENSE-2.0 | ||
;; | ||
;; Unless required by applicable law or agreed to in writing, software | ||
;; distributed under the License is distributed on an "AS IS" BASIS, | ||
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
;; See the License for the specific language governing permissions and | ||
;; limitations under the License. | ||
|
||
;;; Commentary: | ||
|
||
;; Unit tests for the ‘compilation-mode’ integration of ‘go-mode’. | ||
|
||
;;; Code: | ||
|
||
(require 'go-mode) | ||
|
||
(require 'cl-lib) | ||
(require 'ert) | ||
|
||
(ert-deftest go-greedy-test-pattern () | ||
"Verify that https://github.com/dominikh/go-mode.el/issues/361 is fixed." | ||
;; ‘compilation-mode’ doesn’t have its own syntax table, so we use the | ||
;; standard one. | ||
(with-temp-buffer (go-mode)) ; initialize once | ||
(with-syntax-table (standard-syntax-table) | ||
(should-not (string-match-p | ||
(cadr (assq 'go-test compilation-error-regexp-alist-alist)) | ||
"\nfile.go:1:2: word word")))) | ||
|
||
(ert-deftest go-1.14-test-v () | ||
"Verify that https://github.com/dominikh/go-mode.el/issues/362 is fixed." | ||
(with-temp-buffer (go-mode)) ; initialize once | ||
(with-syntax-table (standard-syntax-table) | ||
(cl-destructuring-bind (regexp file line) | ||
(cdr (assq 'go-test compilation-error-regexp-alist-alist)) | ||
(let ((text " Test: foo_test.go:6: message")) | ||
(should (string-match regexp text)) | ||
(should (equal (match-string file text) "foo_test.go")) | ||
(should (equal (match-string line text) "6")))))) | ||
|
||
;;; go-compile-test.el ends here |