No description
  • Emacs Lisp 87.1%
  • Makefile 6.6%
  • Go 6.3%
Find a file
Nicolas Lamirault 490189e68d
Merge pull request #97 from nanjj/master
Removed go-mode dependency
2023-02-21 10:45:11 +01:00
.github Update actions/setup-python action to v3 2022-03-03 16:56:51 +00:00
test Fix: unit test 2021-02-21 22:53:13 +01:00
var Bump version 2015-12-18 09:50:54 +01:00
.gitignore Update project 2015-10-30 13:42:57 +01:00
.projectile Update build 2014-10-08 18:04:21 +02:00
.whitesource Add .whitesource configuration file 2021-01-11 14:15:18 +00:00
Cask Remove GNU archive 2015-11-17 10:17:19 +01:00
ChangeLog.md Update: changelog and test version 2017-08-23 10:39:58 +02:00
circle.yml FIX CircleCI build 2016-04-14 10:21:39 +02:00
CONTRIBUTING.md Also this. :) 2016-09-23 16:07:41 +02:00
gotest.el Removed go-mode dependency 2023-02-17 12:13:49 +08:00
LICENSE Init project 2014-04-10 13:47:54 +02:00
Makefile Bump version and copyright 2016-01-25 15:03:50 +01:00
README.md Rerun current test with go-test-current-test-cache() 2019-11-15 00:24:30 +02:00
renovate.json Add renovate.json 2021-04-26 17:10:24 +00:00

gotest.el

License GPL 3

  • Master : MELPA Stable Circle CI Coverage Status
  • Develop: Melpa Status Circle CI Coverage Status

Run Go tests and programs from Emacs (>= 24.3)

Installation

The recommended way to install gotest.el is via MELPA:

M-x package-install gotest.el

or Cask:

(depends-on "gotest.el")

Usage

The following interactive commands can be run via M-x or bound to a key of your choice.

All go-test-* functions can optionally configure the buffer-local go-test-args variable to pass additional arguments. Or, by using a prefix command, you will be prompted for arguments. For example: C-u M-x go-test-current-test.

When using the '_ prefix arg with any of the go-test-* or go-run functions, the most recent arguments from history will be used without prompting. For example: M-- M-x go-run.

go-test-current-test

Launch unit tests for the current test.

go-test-current-test-cache

Rerun the current test.

go-test-current-file

Launch unit tests and examples for the current file

go-test-current-project

Launch unit tests and examples for the current project.

go-test-current-coverage

Launch unit tests coverage for the current project.

go-test-current-benchmark

Launch go benchmark on current benchmark

go-test-current-file-benchmarks

Launch go benchmark on current file

go-test-current-project-benchmarks

Launch go benchmark on current project

go-run

Launch program via go run. Optionally configure the buffer-local go-test-args variable to pass additional arguments. Or, by using a prefix command, you will be prompted for arguments. For example: C-u M-x go-run.

Be sure to make use of minibuffer history (C-r) to recall recent arguments to go run. And remember that the M-- prefix can be used in combination with your go run key binding to use the most recent arguments without prompting. The go file is included in history, so you can go-run from history regardless of which buffer you are currently visiting.

Example key bindings

You can create some key bindings with these commands:

(define-key go-mode-map (kbd "C-x f") 'go-test-current-file)
(define-key go-mode-map (kbd "C-x t") 'go-test-current-test)
(define-key go-mode-map (kbd "C-x p") 'go-test-current-project)
(define-key go-mode-map (kbd "C-x b") 'go-test-current-benchmark)
(define-key go-mode-map (kbd "C-x x") 'go-run)

Addons

Gb

If your project use gb, gotest will use this tool to launch unit tests.

Development

Cask

gotest.el use Cask for dependencies management. Install it and retrieve dependencies :

$ curl -fsSkL https://raw.github.com/cask/cask/master/go | python
$ export PATH="$HOME/.cask/bin:$PATH"
$ cask

Testing

  • Launch unit tests from shell

    $ make clean test

  • Using overseer :

Keybinding Description
C-c , t launch unit tests from buffer
C-c , b launch unit tests
C-c , g launch unit tests with tag (find, regexp, ...)
  • Tips:

If you want to launch a single unit test, add a specify tag :

(ert-deftest test-foobar ()
  :tags '(current)

And launch it using : C-c , g and specify tag : current

Support / Contribute

See here

Changelog

A changelog is available here.

License

See LICENSE.

Contact

Nicolas Lamirault nicolas.lamirault@gmail.com