Vim plugin for https://github.com/hexdigest/gounit

gounit-vim

Vim plugin for gounit tool that allows you to generate Go tests easily.

Demo

demo

Installation

gounit-vim requires gounit to be available in your $PATH. Alternatively you can provide path to gounit using g:gounit_bin setting.

Plugin installation:

  • Pathogen
    git clone https://github.com/hexdigest/gounit-vim.git ~/.vim/bundle/gounit-vim
    
  • vim-plug
    Plug 'hexdigest/gounit-vim'
    
  • NeoBundle
    NeoBundle 'hexdigest/gounit-vim'
    
  • Vundle
    Plugin 'hexdigest/gounit-vim'
    
  • Vim packages (since Vim 7.4.1528)
    git clone https://github.com/hexdigest/gounit-vim.git ~/.vim/pack/plugins/start/gounit-vim
    

You will also need to install all the necessary GoUnit binaries. It is easy to install by providing a command :GoUnitInstallBinaries, which will go get all the required binaries.

Usage

Call :GoUnit to generate test for the function declaration in the current line or all functions selected in visual mode. GoUnit also understands "range" parameters:

:5,10GoUnit     " genereate tests for functions from line 5 to line 10
:.,$GoUnit      " from the current line till the end of the file
:0,.GoUnit      " from the first line to the current line
:%GoUnit        " generate tests for the whole file

These commands generate tests using template that you set as a preferred with the :GoUnitTemplateUse <template> command. If you don't want to change your preferred template you can use all of the above commands followed by the name of the template, i.e. :GoUnit minimock If you have wildmenu option enabled you can pick desired template from the list of all registered templates with :GoUnit <TAB>.

Managing templates

There are few commands to manage your test templates:

:GoUnitTemplateAdd             " register contents of the current buffer as a new templates
:GoUnitTemplateAdd /file/name  " register /file/name as new template
:GoUnitTemplateDel template    " remove template
:GoUnitTemplateList            " display all registered test templates
:GoUnitTemplateUse template    " set template as preferred

Also you can create useful maps to use it with vim-go plugin for fast test generation.

" maps your leader key + gt to generate tests for the function under your cursor
nnoremap <leader>gt :normal vaf<cr>:GoUnit<cr>

Settings

If you want you can set path to your gounit binary if it's not in your path, for example:

let g:gounit_bin = '/home/user/go/bin/gounit'
Owner
Max Chechel
Program or be programmed
Max Chechel
Similar Resources

Integrated console application library, using Go structs as commands, with menus, completions, hints, history, Vim mode, $EDITOR usage, and more ...

Integrated console application library, using Go structs as commands, with menus, completions, hints, history, Vim mode, $EDITOR usage, and more ...

Gonsole - Integrated Console Application library This package rests on a readline console library, (giving advanced completion, hint, input and histor

Nov 20, 2022

Vim made in Go that you shouldn't use.

novavim This is my attempt at making Vim from scratch in Go, meaning this project will utilize no libs outside of the Go standard library: no ncurses,

Aug 4, 2022

go program that installs and customizes ohmyzsh tmux vim via various plugins and other nice to haves

go program that installs and customizes ohmyzsh tmux vim via various plugins and other nice to haves

Pimp-My-Shell Table of Contents Pimp-My-Shell Install Usage About Resources Tmux Hotkeys VIM Hotkeys Adjusting Custom Aliases Mac Fix Terminal bind ke

Dec 22, 2022

Go-github-actions - `go-github-actions` is a package for developing GitHub Actions

go-github-actions go-github-actions is a package for developing GitHub Actions.

Feb 6, 2022

Decode mp3 base on https://github.com/lieff/minimp3

minimp3 Decode mp3 base on https://github.com/lieff/minimp3 See examples in example directory. make and make test test the example. package main impo

Dec 25, 2022

go implementation of lightbend's HOCON configuration library https://github.com/lightbend/config

HOCON (Human-Optimized Config Object Notation) Configuration library for working with the Lightbend's HOCON format. HOCON is a human-friendly JSON sup

Dec 3, 2022

A Go library for an efficient implementation of a skip list: https://godoc.org/github.com/MauriceGit/skiplist

A Go library for an efficient implementation of a skip list: https://godoc.org/github.com/MauriceGit/skiplist

Fast Skiplist Implementation This Go-library implements a very fast and efficient Skiplist that can be used as direct substitute for a balanced tree o

Dec 30, 2022

:warning: Deprecrated in favor of https://github.com/piquette/finance-go

go-finance go-finance is a Go library for retrieving financial data for quantitative analysis. Deprecation Warning! This library will no longer be mai

Dec 14, 2022

:exclamation::exclamation::exclamation: [deprecated] Moved to https://github.com/go-macaron/macaron

:exclamation::exclamation::exclamation: [deprecated] Moved to https://github.com/go-macaron/macaron

Macaron Package macaron is a high productive and modular web framework in Go. Current version: 0.6.8 Getting Started The minimum requirement of Go is

Aug 20, 2021

Openldap (LDAP) binding for Golang (go) ; no more support ; you may have a look at https://github.com/go-ldap/ldap

OpenLDAP this is Openldap binding in GO language. I don't work any more with golang, so, please fork this project. Installation : Installation is easy

Mar 4, 2021

An Etsy StatsD (https://github.com/etsy/statsd) implementation in Go

STATSD-GO Port of Etsy's statsd, written in Go. This was forked from https://github.com/amir/gographite to provide Ganglia submission support. USAGE U

Mar 5, 2021

tiny linear interpolation library for go (factored out from https://github.com/sgreben/yeetgif)

piecewiselinear A tiny library for linear interpolation. O(log(N)) per evaluation for N control points. import "github.com/sgreben/piecewiselinear" Ge

Sep 27, 2022

auto-generate capnproto schema from your golang source files. Depends on go-capnproto-1.0 at https://github.com/glycerine/go-capnproto

bambam: auto-generate capnproto schema from your golang source files. Adding capnproto serialization to an existing Go project used to mean writing a

Sep 27, 2022

Cap'n Proto library and parser for go. This is go-capnproto-1.0, and does not have rpc. See https://github.com/zombiezen/go-capnproto2 for 2.0 which has rpc and capabilities.

Version 1.0 vs 2.0 Update 2015 Sept 20: Big news! Version 2.0 of the go-bindings, authored by Ross Light, is now released and newly available! It feat

Nov 29, 2022

Parse and generate m3u8 playlists for Apple HTTP Live Streaming (HLS) in Golang (ported from gem https://github.com/sethdeckard/m3u8)

go-m3u8 Golang package for m3u8 (ported m3u8 gem https://github.com/sethdeckard/m3u8) go-m3u8 provides easy generation and parsing of m3u8 playlists d

Nov 19, 2022

:exclamation::exclamation::exclamation: [deprecated] Moved to https://github.com/go-macaron/macaron

:exclamation::exclamation::exclamation: [deprecated] Moved to https://github.com/go-macaron/macaron

Macaron Package macaron is a high productive and modular web framework in Go. Current version: 0.6.8 Getting Started The minimum requirement of Go is

Aug 20, 2021

The fastest HTTP/2 Go Web Framework. AWS Lambda, gRPC, MVC, Unique Router, Websockets, Sessions, Test suite, Dependency Injection and more. A true successor of expressjs and laravel | 谢谢 https://github.com/kataras/iris/issues/1329 |

The fastest HTTP/2 Go Web Framework. AWS Lambda, gRPC, MVC, Unique Router, Websockets, Sessions, Test suite, Dependency Injection and more. A true successor of expressjs and laravel | 谢谢 https://github.com/kataras/iris/issues/1329 |

News This is the under-development branch. Stay tuned for the upcoming release v12.2.0. Looking for a stable release? Head over to the v12.1.8 branch

Dec 28, 2022
Comments
  • Inner vim function for installing gounit binaries

    Inner vim function for installing gounit binaries

    Implemented kind of "vim-go" function for downloading gounit binaries through vim. So now you can just connect gounit-vim with your plugin manager and simply use :GoUnitInstallBinaries to download gounit into your $GOPATH. It checks if gounit is already installed and if not it is using go get underneath. (I decided to add this command and not to use auto call check of the function when plugin loads) In the future this functionality can be simplified to use less code, but for now this should work fine.

    Also fixed broken links in README file and added exta information there.

Go development plugin for Vim
Go development plugin for Vim

vim-go Features This plugin adds Go language support for Vim, with the following main features: Compile your package with :GoBuild, install it with :G

Jan 7, 2023
A terminal based game that teaches you how to use Vim.
A terminal based game that teaches you how to use Vim.

VimMan Learn how to use Vim in its natural environment, the Terminal! About VimMan is terminal program that's a semi editor and a semi game. The purpo

Dec 5, 2022
A Golang plugin collection for SublimeText 3, providing code completion and other IDE-like features.

GoSublime Intro GoSublime is an IDE-like plugin for Sublime Text 3 mainly, but not limited to, providing integration for most of your Go/Golang develo

Jan 4, 2023
Vim compiler plugin for Go (golang)
Vim compiler plugin for Go (golang)

Vim compiler file for Go (golang) Compiles Go files in the background and usefully underlines and reports errors to the QuickFix window: Installation:

Sep 27, 2022
Go development plugin for Vim
Go development plugin for Vim

vim-go Features This plugin adds Go language support for Vim, with the following main features: Compile your package with :GoBuild, install it with :G

Jan 7, 2023
🐉 BLAZINGLY FAST CLI plugin manager for (neo)vim

viper BLAZINGLY FAST CLI plugin manager for (neo)vim. Usage Viper does all the nice and basic things you'd expect from a (neo)vim plugin manager, and

Jun 9, 2022
*DEPRECATED* Please use https://gopkg.in/redsync.v1 (https://github.com/go-redsync/redsync)

Redsync.go This package is being replaced with https://gopkg.in/redsync.v1. I will continue to maintain this package for a while so that its users do

Nov 20, 2022
Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://developer.github.com/v4/).

githubv4 Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://docs.github.com/en/graphql). If you're looking for a client

Dec 26, 2022
Learning Vim and Vimscript doesn't have to be hard. This is the guide that you're looking for.
Learning Vim and Vimscript doesn't have to be hard. This is the guide that you're looking for.

Learn Vim (the Smart Way) What's This? Learn Vim (the Smart Way) is a guide to learn the good parts of Vim. There are many places to learn Vim: the vi

Jan 1, 2023
A terminal based game that teaches you how to use Vim.
A terminal based game that teaches you how to use Vim.

VimMan Learn how to use Vim in its natural environment, the Terminal! About VimMan is terminal program that's a semi editor and a semi game. The purpo

Dec 5, 2022