# 使用 Homebrew 安装 testscript

查看 testscript 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:testscript
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install testscript
```

  证据: local Homebrew formula metadata

## 软件包事实

- **软件包键:** brew:testscript
- **软件包管理器:** Homebrew
- **版本:** 1.15.0
- **来源摘要:** Integration tests for command-line applications in .txtar format
- **主页:** <https://github.com/rogpeppe/go-internal/tree/master/cmd/testscript>
- **仓库:** <https://github.com/rogpeppe/go-internal>
- **最后更新:** 2026-07-26T00:50:38+02:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- testscript (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 1.15.0
## 项目历史与用法

testscript is a small Go-oriented command and package for running filesystem-based command scripts, often stored as txtar files, in fresh temporary work directories.

### 项目历史

The rogpeppe/go-internal repository was created in September 2018 and describes itself as selected Go-internal packages factored out from the standard library. The testscript package source carries Go Authors copyright notices from 2018 and documents the same script-testing style used around Go command tests.

The Homebrew formula packages the cmd/testscript executable from that repository rather than a large standalone application. Its command README says testscript runs scripts in fresh temporary work directory trees and is designed for self-contained reproductions of command sequences.

### 采用历史

testscript's adoption is mostly inside the Go developer-tools niche: Go projects use it to write integration-style command tests with embedded fixture files, expected stdout and stderr checks, and temporary working trees.

In package-manager terms it is a niche but useful binary: installing it gives developers a direct runner for .txtar or .txt scripts without embedding it into a Go test harness.

### 使用方式

The command runs files passed on the command line, supports environment passthrough with -e, updates embedded expected files with -u, and can preserve the temporary work directory with -work for debugging.

The package API is used from Go tests with testscript.Run, where a testdata directory contains txtar or txt scripts and each script defines a subtest.

### 为什么软件包爱好者会关心

testscript is the kind of tool package nerds notice because it turns a testing convention into a standalone command. It is especially relevant for maintainers of CLIs, compilers, formatters, and other command-line programs where golden command transcripts are easier to review than custom Go test code.

Its use of txtar keeps test fixtures and scripts in one text file, making it friendly to source-control review and reproducible bug reports.

### 时间线

- 2018: rogpeppe/go-internal repository created and testscript package documentation appears with Go Authors copyright.
- 2018: Example txtar module proxy data in the command README uses a 2018 timestamp, matching the Go modules testing era.
- 2026: Repository metadata shows continued updates.

### Related projects

- Go cmd/go tests, golang.org/x/tools/txtar, go-internal/goproxytest, Go module proxy testing, and command-line integration test harnesses.

### 来源

- <https://github.com/rogpeppe/go-internal repository metadata>
- <https://github.com/rogpeppe/go-internal/tree/master/cmd/testscript README>
- <https://pkg.go.dev/github.com/rogpeppe/go-internal/testscript>
- input.source_facts.package-manager


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals


## Combined YAML source

View the package source record on GitHub. [combined/testscript.yml](https://github.com/mxcl/pkgdb/blob/main/combined/testscript.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- cross-ecosystem install command graph
