Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.png filter=lfs diff=lfs merge=lfs -text
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ coverage.txt
coverage.html
coverage.xml
dist

third_party
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,10 @@ repos:
args: [run, fmt]
language: system
pass_filenames: false
- id: autotoc
name: generate toc
entry: mise
args: [run, autotoc]
language: system
files: ^README\.md$
pass_filenames: false
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,42 @@
# Teastraw
<img src="./assets/teastraw.png" width="90" style="margin-right:10px" align=left alt="teastraw logo">
<H1>Teastraw</H1><br>


![License](https://img.shields.io/github/license/fiffeek/teastraw.svg?style=flat)
![Code Size](https://img.shields.io/github/languages/code-size/fiffeek/teastraw.svg?style=flat)
![Go Version](https://img.shields.io/github/go-mod/go-version/fiffeek/teastraw?style=flat)
![Go Report Card](https://goreportcard.com/badge/github.com/fiffeek/teastraw)
![Build](https://img.shields.io/github/actions/workflow/status/fiffeek/teastraw/test.yaml?branch=main&style=flat)


A Go package for end-to-end testing of Terminal User Interface (TUI) applications.

## Table of Contents

<!--ts-->
* [Teastraw](#teastraw)
* [Table of Contents](#table-of-contents)
* [Overview](#overview)
* [Installation](#installation)
* [Quick Start](#quick-start)
* [Key Features](#key-features)
* [Screen Validation](#screen-validation)
* [Waiting for Conditions](#waiting-for-conditions)
* [Input Simulation](#input-simulation)
* [Graceful Shutdown](#graceful-shutdown)
* [Configuration Options](#configuration-options)
* [Terminal Size](#terminal-size)
* [Exit Sequences](#exit-sequences)
* [Testing Patterns](#testing-patterns)
* [Golden File Testing](#golden-file-testing)
* [Time-based Testing](#time-based-testing)
* [Examples](#examples)
* [Comparison to Teatest](#comparison-to-teatest)
* [Contributing](#contributing)
* [License](#license)
* [Credits](#credits)
<!--te-->

## Overview

`Teastraw` provides a test runner that can interact with TUI applications by:
Expand Down Expand Up @@ -171,8 +206,8 @@ runner, err := exp.NewTestRunner(
exp.WithCommand(cmd),
)

[A few common ones](https://github.com/fiffeek/teastraw/blob/main/pkg/exp/const.go#L3) are passed by default, you can also refer to them in your code.
```
[A few common ones](https://github.com/fiffeek/teastraw/blob/main/pkg/exp/const.go#L3) are passed by default, you can also refer to them in your code.

## Testing Patterns

Expand Down
3 changes: 3 additions & 0 deletions assets/teastraw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ description = "Install golang dependencies"
run = "go mod download all"
sources = ["go.mod", "go.sum"]

[tasks."install:autotoc"]
description = "Install auto toc script"
run = [
"mkdir -p ./third_party",
"wget -q https://raw.githubusercontent.com/ekalinin/github-markdown-toc/master/gh-md-toc",
"chmod 755 gh-md-toc",
"mv gh-md-toc ./third_party/",
"./third_party/gh-md-toc --help >/dev/null 2>&1",
]

[tasks."autotoc"]
description = "Generate TOC for README.md"
run = ["./scripts/autotoc"]
sources = ["README.md"]

[tasks."install"]
depends = ["install:*"]
run = ["python -m pre_commit install --install-hooks"]
Expand Down
8 changes: 8 additions & 0 deletions scripts/autotoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -euo pipefail

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
README="README.md"

"${SCRIPT_DIR}/../third_party/gh-md-toc" --no-backup --hide-footer "$README"