An open API service indexing awesome lists of open source software.

https://github.com/fd0/termtest

Test terminal Go applications using tmux
https://github.com/fd0/termtest

Last synced: about 1 year ago
JSON representation

Test terminal Go applications using tmux

Awesome Lists containing this project

README

          

[![GoDoc](https://godoc.org/github.com/fd0/termtest?status.svg)](http://godoc.org/github.com/fd0/termtest)
[![Build Status](https://travis-ci.org/fd0/termtest.svg?branch=master)](https://travis-ci.org/fd0/termtest)

termtest is a small helper program to run terminal user interface tests by
using tmux in Go.

Example:

```go
// create terminal
term, _ := termtest.New()

// run a command in a terminal with 12 columns and 13 lines
buf, _ := term.Run(12, 13, "echo This is a long line that will wrap for sure")

// print the output string:
// Output: "This is a lo\nng line that\n will wrap f\nor sure\n\n\n\n\n\n\n\n\n\n"
fmt.Printf("%q\n", buf)

// stop the tmux instance
term.Exit()
```