Commit 74a75ac5 authored by Sebastian Wiesner's avatar Sebastian Wiesner

Add unit tests for Go syntax checking

parent a2810a08
......@@ -24,4 +24,5 @@ Flycheck provides on-the-fly syntax checker with
(depends-on "cperl-mode")
(depends-on "php-mode")
(depends-on "php+-mode")
(depends-on "sass-mode"))
(depends-on "sass-mode")
(depends-on "go-mode"))
// A simple syntax error in Go
package main
func ta ta() {
}
\ No newline at end of file
;;; test-gofmt.el --- Test the gofmt checker -*- lexical-binding: t; -*-
;; Copyright (c) 2013 Sebastian Wiesner <lunaryorn@gmail.com>,
;;
;; Author: Sebastian Wiesner <lunaryorn@gmail.com>,
;; URL: https://github.com/lunaryorn/flycheck
;; This file is not part of GNU Emacs.
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Code:
(require 'ert)
(require 'flycheck)
(require 'go-mode nil :no-error)
(ert-deftest checker-go-gofmt-syntax-error ()
"Test a syntax error."
:expected-result (flycheck-fail-unless-checker 'go-gofmt)
(flycheck-with-resource-buffer "test-go/syntax-error.go"
(go-mode)
(flycheck-buffer-sync)
(flycheck-should-errors
'(5 9 "expected '(', found 'IDENT' ta" error)
'(6 1 "expected ')', found '}'" error))))
;; Local Variables:
;; coding: utf-8
;; End:
;;; test-gofmt.el ends here
......@@ -18,7 +18,9 @@
# Provision a VM with necessary packages to test all Flycheck checkers
ppa () {
sudo apt-add-repository -y "$1"
for ppa in "$@"; do
sudo apt-add-repository -y "$ppa"
done
}
apt_update () {
......@@ -56,9 +58,7 @@ apt_update
apt make python-software-properties
# Bring in the necessary PPAs
ppa ppa:cassou/emacs
ppa ppa:ondrej/php5
ppa ppa:richarvey/nodejs
ppa ppa:cassou/emacs ppa:ondrej/php5 ppa:richarvey/nodejs ppa:gophers/go
apt_update
# Install texinfo to build documentation
......@@ -82,7 +82,8 @@ apt bash \
lua5.2 lua-mode \
chktex lacheck \
xmlstarlet \
zsh
zsh \
golang-stable
pip flake8 pylint pyflakes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment