Skip to content

balazs4/expect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

expect

A minimal Go utility for line-by-line assertion testing. Reads lines from standard input and compares each to the corresponding expected value provided as command-line arguments. Useful for simple test scripts and shell pipelines.

Usage

printf "foo\nbar\n" | ./expect foo bar
  • For each line of input, expect compares it to the corresponding argument.
  • If a line does not match, an error is printed to stderr.
  • The program exits with the number of failed comparisons as the exit code.
  • If there is no input, it exits with code 128.

Example

$ printf "hello\nworld\n" | ./expect hello world
$ echo $?
0

$ printf "hello\nthere\n" | ./expect hello world
expected: 'world'
  actual: 'there'

$ echo $?
1

Author

balazs4

Note: This readme.md was generated by AI (opencode v0.6.4, model: github-copilot/gpt-4.1), but all code is 100% manually written.

About

text assertion

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published