Merge branch 'main' into move-to-uzers

This commit is contained in:
Christina Sørensen 2023-08-22 16:07:11 +02:00
commit 6e5920597d
No known key found for this signature in database
GPG key ID: CDDC792F655251ED
35 changed files with 1000 additions and 25 deletions

13
.gitignore vendored
View file

@ -10,10 +10,11 @@ target
# Compiled artifacts
# (see devtools/*-package-for-*.sh)
/exa-linux-x86_64
/exa-linux-x86_64-*.zip
/exa-macos-x86_64
/exa-macos-x86_64-*.zip
/eza-linux-x86_64
/eza-linux-x86_64-*.zip
/eza-macos-x86_64
/eza-macos-x86_64-*.zip
/eza_*_amd64.deb
/MD5SUMS
/SHA1SUMS
@ -23,3 +24,7 @@ prime
stage
*.snap
.direnv
# VHS testing stuff
out.gif
tests/tmp

View file

@ -2,6 +2,98 @@
All notable changes to this project will be documented in this file.
## [0.10.8] - 2023-08-22
### Bug Fixes
- TextCell building of detailed grid view for hyperlink and icon options
- Block's Colours trait as for file sizes
- --blocksize completion, new description
- Option.views unit tests use --blocksize
- Add missing colon before -w/--width
- Replace exa by eza in help string
- Change exa to eza in invalid option error
- Add missing name section to eza_colors-explanation manpage
- Replace exa by eza in .gitignore
### Documentation
- Update issue templates
- Add git-ignore style/color information to manpage
- --blocksize, new description
- --blocksize, new description
- --blocksize, new description
- Cafkafk -> eza-community
- Add gpg public key for the deb repository
- Add section about debian and ubuntu installation
### Features
- Add `just` and `pandoc` to devShell bc they are necessary for man
- Add `.envrc` so direnv automatically opens the nix dev environment
- Add git-ignored color/style option
- Match folder icon to reflect contents
- Match folder icon to reflect contents
- --blocksize completion, new description
- Add script deb-package.sh
### Miscellaneous Tasks
- Bump libc from 0.2.93 to 0.2.147
- Bump num_cpus from 1.13.0 to 1.16.0
- Bump git2 from 0.16.1 to 0.17.2
- Bump unicode-width from 0.1.8 to 0.1.10
### Refactor
- Fs::fields::Blocks
- File::blocks() name, revise calculation
- Rendering Blocksize like file sizes
- Rename Blocks column to Blocksize
- Use -S/--blocksize and, var BLOCKSIZE
- Unit tests for output.render.blocks
- Flip if (as suggested/demanded by clippy)
### Build
- Add charm to nix develop
- Add tests/tmp to gitignore
- Add initial tape
- Add test runner sketch
- Add test runner to justfile
- Add out.gif to .gitignore
- Add run_tests NAME arg
- Add reference main.txt
- Add gen_test
- Fix typo
- Handle arbitrary NAMES
- Remove commented out code
- Fix code formatting
- Add vhs-runner main function
- Gen_test support automatic gen
- Automatic tape detection
- Add print_msg with ansi color
- Slight documentation/refactor
- Use ansi output on all output
- Disable vhs publish ad
- Add better tracing
- Remove defective sed
- Add color variables
- Add eza-long test
- Add itest testing dir
- Add parallel runner
### Ci
- Help text in xtests
- Nix flake check
- Add labeler for flake
- Add flake description
### Git
- Add deb package to .gitignore
## [0.10.7] - 2023-08-13
### Bug Fixes
@ -35,6 +127,7 @@ All notable changes to this project will be documented in this file.
- Add PR template
- Bump log from 0.4.14 to 0.4.20
- Release 0.10.7
### Refactor

2
Cargo.lock generated
View file

@ -53,7 +53,7 @@ dependencies = [
[[package]]
name = "eza"
version = "0.10.7"
version = "0.10.8"
dependencies = [
"ansi_term",
"datetime",

View file

@ -10,7 +10,25 @@ readme = "README.md"
homepage = "https://github.com/eza-community/eza"
license = "MIT"
repository = "https://github.com/eza-community/eza"
version = "0.10.7"
version = "0.10.8"
[package.metadata.deb]
license-file = [ "LICENCE", "4" ]
depends = "$auto"
extended-description = """
eza is a modern, maintained replacement for ls
"""
section = "utils"
priority = "optional"
assets = [
[ "target/release/eza", "/usr/bin/eza", "0755" ],
[ "target/release/../man/eza.1", "/usr/share/man/man1/eza.1", "0644" ],
[ "target/release/../man/eza_colors.5", "/usr/share/man/man5/eza_colors.5", "0644" ],
[ "completions/bash/eza", "/usr/share/bash-completion/completions/eza", "0644" ],
[ "completions/zsh/_eza", "/usr/share/zsh/site-functions/_eza", "0644" ],
[ "completions/fish/eza.fish", "/usr/share/fish/vendor_completions.d/eza.fish", "0644" ],
]
[[bin]]
@ -66,21 +84,3 @@ debug = false
lto = true
strip = true
opt-level = "s"
[package.metadata.deb]
license-file = [ "LICENCE", "4" ]
depends = "$auto"
extended-description = """
eza is a modern, maintained replacement for ls
"""
section = "utils"
priority = "optional"
assets = [
[ "target/release/eza", "/usr/bin/eza", "0755" ],
[ "target/release/../man/eza.1", "/usr/share/man/man1/eza.1", "0644" ],
[ "target/release/../man/eza_colors.5", "/usr/share/man/man5/eza_colors.5", "0644" ],
[ "completions/bash/eza", "/usr/share/bash-completion/completions/eza", "0644" ],
[ "completions/zsh/_eza", "/usr/share/zsh/site-functions/_eza", "0644" ],
[ "completions/fish/eza.fish", "/usr/share/fish/vendor_completions.d/eza.fish", "0644" ],
]

View file

@ -36,6 +36,9 @@ all-release: build-release test-release
@test-release:
cargo test --workspace --release --verbose
alias itest := integration_tests
@integration_tests:
VHS_PUBLISH=false ./tests/vhs-runner.sh
#------------------------#
# running extended tests #
@ -113,3 +116,22 @@ all-release: build-release test-release
# build and preview the colour configuration man page (eza_colors.5)
@man-5-explanations-preview: man
man "${CARGO_TARGET_DIR:-target}/man/eza_colors-explanation.5"
#---------------#
# release #
#---------------#
# If you're not cafkafk and she isn't dead, don't run this!
#
# usage: release major, release minor, release patch
@release version:
cargo bump '{{version}}'
git cliff -t $(grep '^version' Cargo.toml | head -n 1 | grep -E '([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?' -o) > CHANGELOG.md
cargo check
nix build -L ./#clippy
git checkout -b cafk-release-$(grep '^version' Cargo.toml | head -n 1 | grep -E '([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?' -o)
git commit -asm "chore: release $(grep '^version' Cargo.toml | head -n 1 | grep -E '([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?' -o)"
git push
echo "waiting 10 seconds for github to catch up..."
sleep 10
gh pr create --draft --title "chore: release $(grep '^version' Cargo.toml | head -n 1 | grep -E '([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?' -o)" --body "This PR was auto-generated by our lovely just file" --reviewer cafkafk

View file

@ -103,6 +103,17 @@ For `nix-env` users:
nix-env -i eza
```
### Debian and Ubuntu
Eza is available from [deb.gierens.de](http://deb.gierens.de). The GPG public
key is in this repo under [deb.asc](/deb.asc).
To install eza from this repo use:
```bash
wget -qO- https://raw.githubusercontent.com/eza-community/eza/main/deb.asc | sudo tee /etc/apt/trusted.gpg.d/gierens.asc
echo "deb http://deb.gierens.de stable main" | sudo tee /etc/apt/sources.list.d/gierens.list
sudo apt update
sudo apt install -y eza
```
---

29
deb.asc Normal file
View file

@ -0,0 +1,29 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGTejj8BEAC3Qdi6up8rkFvekeuZiGpuC5OTic+Nd/x6zacrtDKJwdVa6fw3
tVydFW1ELcw33ifWDztvgENqvgMuhcB/lnoDnaAhK8nzT0l+r0gQ7JptPH+8XsZx
PuIFRxgUkS6M45jrZApu/c3/PX3akiBuBnibd+sik72pVSi9pYm00I/yY/+u9Vvo
u4vy/PG/y4Kp1+ewbVyOnaTQoiJXgqceUYqNfhShcN7dssa/Td6G0xPhS1XeQZ81
QWwPNEzGWomGJ/igZPcm31qtIwcHXn3m8UZbCxUHHzseZ0hOOYqVSrSIj+U1RIma
rmcbdAAi1wQei0P142/Gkq1fLdscrZPc0b0L8JbZnymAvg2WWE6SQ3/7Ux0Y9hc3
wsXuiwU38Qg0EaDMSXyUKAbK+4/tuP9mbx4PyKuDUmjJnPTCvbJxe2kC8rdZrOgn
4qbwHY7FCEBpG28VhV07dwueZcFC/VCqGrbmrJC7rl6avT5xpOIRslUTJGmifx3Z
0hmL6rzTQz00FVNSXyxLnz1XYUTLm7QyzywTv8HTTfy5o21N2eOHqbMkBA9MJiic
lnVSH1vCn/5rd+fwRQ/7yLKAdeUcRyxkdVWTUYDnVtQF199MAuXWv4nudjvS3046
Y9WpJGiZEi9PqeIxmYYHOZ/jYVF1RpMOyVnZhzRhn4Yy+uzJtUeW45nGyQARAQAB
tDZTYW5kcm8tQWxlc3NpbyBHaWVyZW5zIChhcHRseSBrZXkpIDxzYW5kcm9AZ2ll
cmVucy5kZT6JAk4EEwEKADgWIQQVSLyKS00miPmw2vfsKeIJDOP9QwUCZN6OPwIb
LwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRDsKeIJDOP9Q26qEACkbm29cF5f
7J95TAMOzNfjwfgEEPTZt9YUQxmYYlO3LGOShx/hogoWGhpw6qXQP0/lRlXcmNWD
3J5rN+YmQSIYRP0VvOVJ/XYpgsoS90JwmukbJte4Wu1Goomh1dPv1z/ag4jToSzu
faSbwoUa46BmdRBOrOH/w/Ro7U6jLhH9saIivJfexksYeMprXahgoWsFGurl7mt0
OaN3C6YSMkoJjpufCTfHKagBRT4ZYRw1JpTF+oap0VZgKtg33pnxVvSKdZJEY9BG
su47/eZM0bOCMll1upitF8TQ5DFING6+SRrmT8xAyUOCQBIid/9hBxX5mTYTjKW2
ZVteOkCowJwMwx134BffTMWMAMRw27Vxtuuugn6a9yd9pbK95aug62VpbvO8xWM+
RocqeuQvh0Ii8kpH+sLjdpceMf1c01cYu97DjtdQ54FGtI4r1kOyh/BO7mI0omoJ
hFunhQKKM8q1xUyIs3RvYALuM5VzEWCHwXBYdiNWYDVBC/sNje67A8SXXXjJLhcr
9cCpJ5AUmkrLoQvgdewMpuIlmtPRbdv8hkmOUDPkD58AcDirvggXp63IiWlFYQ9C
EoDLfUYQ6aJmw1fRI8/QsP3Q50aN6dkZRsDCcpxoNX9YzuU6+o1ha+ZNRpmfJvZg
ULP33eq15gJlsGrxo2HZ+f6w4pFFy4juDQ==
=MX5x
-----END PGP PUBLIC KEY BLOCK-----

118
devtools/deb-package.sh Executable file
View file

@ -0,0 +1,118 @@
#!/bin/bash
if [ -z "$1" ]
then
echo "Usage: deb-package.sh <version>"
echo ""
echo "Package the given version number into a .deb package."
echo "Example: deb-package.sh 0.10.7"
exit 1
fi
DESTDIR=/usr/bin
DOCDIR=/usr/share/man/
NAME="eza"
VERSION=$1
ARCH="amd64"
DEB_TMP_DIR="${NAME}_${VERSION}_${ARCH}"
DEB_PACKAGE="${NAME}_${VERSION}_${ARCH}.deb"
read -r -d '' DEB_CONTROL << EOM
Package: ${NAME}
Version: ${VERSION}
Section: utils
Priority: optional
Architecture: ${ARCH}
Depends: libc6
Maintainer: Sandro-Alessio Gierens <sandro@gierens.de>
Description: Modern replacement for ls
eza is a modern replacement for ls. It uses colours for information by
default, helping you distinguish between many types of files, such as whether
you are the owner, or in the owning group.
.
It also has extra features not present in the original ls, such as viewing the
Git status for a directory, or recursing into directories with a tree view.
EOM
read -r -d '' DEB_COPYRIGHT << EOM
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ${NAME}
Upstream-Contact: Christina Sørensen <christina@cafkafk.com>
Source: https://github.com/eza-community/eza/releases
Files: *
License: MIT
Copyright: 2023 Christina Sørensen <christina@cafkafk.com>
Files: debian/*
License: MIT
Copyright: 2023 Christina Sørensen <christina@cafkafk.com>
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
EOM
# create temporary build directory
mkdir -p ${DEB_TMP_DIR}
# create directory structure
mkdir -p ${DEB_TMP_DIR}${DESTDIR}
mkdir -p ${DEB_TMP_DIR}${DOCDIR}
mkdir -p ${DEB_TMP_DIR}${DOCDIR}/man1
mkdir -p ${DEB_TMP_DIR}${DOCDIR}/man5
mkdir -p ${DEB_TMP_DIR}/DEBIAN
mkdir -p ${DEB_TMP_DIR}/usr/share/doc/${NAME}
# fix directory permissions
chmod 755 -R ${DEB_TMP_DIR}
# binary
cp target/release/${NAME} ${DEB_TMP_DIR}${DESTDIR}
chmod 755 ${DEB_TMP_DIR}${DESTDIR}/${NAME}
# man page
gzip -cn9 target/man/eza.1 > ${DEB_TMP_DIR}${DOCDIR}man1/eza.1.gz
gzip -cn9 target/man/eza_colors.5 > ${DEB_TMP_DIR}${DOCDIR}man5/eza_colors.5.gz
gzip -cn9 target/man/eza_colors-explanation.5 > ${DEB_TMP_DIR}${DOCDIR}man5/eza_colors-explanation.5.gz
chmod 644 ${DEB_TMP_DIR}${DOCDIR}/**/*.gz
# control file
touch ${DEB_TMP_DIR}/DEBIAN/control
echo "${DEB_CONTROL}" > ${DEB_TMP_DIR}/DEBIAN/control
chmod 644 ${DEB_TMP_DIR}/DEBIAN/control
# changelog
cp CHANGELOG.md ${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog
gzip -cn9 ${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog > ${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog.gz
rm ${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog
chmod 644 ${DEB_TMP_DIR}/usr/share/doc/${NAME}/changelog.gz
# copyright file
touch ${DEB_TMP_DIR}/usr/share/doc/${NAME}/copyright
echo "${DEB_COPYRIGHT}" > ${DEB_TMP_DIR}/usr/share/doc/${NAME}/copyright
chmod 644 ${DEB_TMP_DIR}/usr/share/doc/${NAME}/copyright
# build package
dpkg-deb --build --root-owner-group ${DEB_TMP_DIR}
# clean up
rm -rf ${DEB_TMP_DIR}
# test package
lintian ${DEB_PACKAGE}

View file

@ -71,7 +71,7 @@
# For `nix develop`:
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [toolchain just pandoc];
nativeBuildInputs = with pkgs; [ toolchain just pandoc vhs ];
};
# for `nix flake check`

View file

@ -1,3 +1,7 @@
# Name
eza_colors-explanation — more details on customizing eza colors
# Eza Color Explanation
eza provides its own built\-in set of file extension mappings that cover a large range of common file extensions, including documents, archives, media, and temporary files.

0
tests/itest/a Normal file
View file

0
tests/itest/b Normal file
View file

0
tests/itest/c Normal file
View file

0
tests/itest/d Normal file
View file

0
tests/itest/e Normal file
View file

0
tests/itest/f Normal file
View file

0
tests/itest/g Normal file
View file

0
tests/itest/h Normal file
View file

0
tests/itest/i Normal file
View file

0
tests/itest/j Normal file
View file

0
tests/itest/k Normal file
View file

0
tests/itest/l Normal file
View file

0
tests/itest/m Normal file
View file

0
tests/itest/n Normal file
View file

0
tests/itest/o Normal file
View file

0
tests/itest/p Normal file
View file

0
tests/itest/q Normal file
View file

View file

@ -0,0 +1,152 @@
>
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest/
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
>
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
>
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l --blocksize
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l --blocksize
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l --blocksize
.rw-r--r-- 0 0 ces 20 Aug 06:45 a
.rw-r--r-- 0 0 ces 20 Aug 06:45 b
.rw-r--r-- 0 0 ces 20 Aug 06:45 c
.rw-r--r-- 0 0 ces 20 Aug 06:45 d
.rw-r--r-- 0 0 ces 20 Aug 06:45 e
.rw-r--r-- 0 0 ces 20 Aug 06:45 f
.rw-r--r-- 0 0 ces 20 Aug 06:45 g
.rw-r--r-- 0 0 ces 20 Aug 06:45 h
.rw-r--r-- 0 0 ces 20 Aug 06:45 i
.rw-r--r-- 0 0 ces 20 Aug 06:45 j
.rw-r--r-- 0 0 ces 20 Aug 06:45 k
.rw-r--r-- 0 0 ces 20 Aug 06:45 l
.rw-r--r-- 0 0 ces 20 Aug 06:45 m
.rw-r--r-- 0 0 ces 20 Aug 06:45 n
.rw-r--r-- 0 0 ces 20 Aug 06:45 o
.rw-r--r-- 0 0 ces 20 Aug 06:45 p
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l --blocksize
.rw-r--r-- 0 0 ces 20 Aug 06:45 a
.rw-r--r-- 0 0 ces 20 Aug 06:45 b
.rw-r--r-- 0 0 ces 20 Aug 06:45 c
.rw-r--r-- 0 0 ces 20 Aug 06:45 d
.rw-r--r-- 0 0 ces 20 Aug 06:45 e
.rw-r--r-- 0 0 ces 20 Aug 06:45 f
.rw-r--r-- 0 0 ces 20 Aug 06:45 g
.rw-r--r-- 0 0 ces 20 Aug 06:45 h
.rw-r--r-- 0 0 ces 20 Aug 06:45 i
.rw-r--r-- 0 0 ces 20 Aug 06:45 j
.rw-r--r-- 0 0 ces 20 Aug 06:45 k
.rw-r--r-- 0 0 ces 20 Aug 06:45 l
.rw-r--r-- 0 0 ces 20 Aug 06:45 m
.rw-r--r-- 0 0 ces 20 Aug 06:45 n
.rw-r--r-- 0 0 ces 20 Aug 06:45 o
.rw-r--r-- 0 0 ces 20 Aug 06:45 p
────────────────────────────────────────────────────────────────────────────────

View file

@ -0,0 +1,266 @@
>
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest/
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
>
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
>
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l
.rw-r--r-- 0 ces 20 Aug 06:45 a
.rw-r--r-- 0 ces 20 Aug 06:45 b
.rw-r--r-- 0 ces 20 Aug 06:45 c
.rw-r--r-- 0 ces 20 Aug 06:45 d
.rw-r--r-- 0 ces 20 Aug 06:45 e
.rw-r--r-- 0 ces 20 Aug 06:45 f
.rw-r--r-- 0 ces 20 Aug 06:45 g
.rw-r--r-- 0 ces 20 Aug 06:45 h
.rw-r--r-- 0 ces 20 Aug 06:45 i
.rw-r--r-- 0 ces 20 Aug 06:45 j
.rw-r--r-- 0 ces 20 Aug 06:45 k
.rw-r--r-- 0 ces 20 Aug 06:45 l
.rw-r--r-- 0 ces 20 Aug 06:45 m
.rw-r--r-- 0 ces 20 Aug 06:45 n
.rw-r--r-- 0 ces 20 Aug 06:45 o
.rw-r--r-- 0 ces 20 Aug 06:45 p
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l
.rw-r--r-- 0 ces 20 Aug 06:45 a
.rw-r--r-- 0 ces 20 Aug 06:45 b
.rw-r--r-- 0 ces 20 Aug 06:45 c
.rw-r--r-- 0 ces 20 Aug 06:45 d
.rw-r--r-- 0 ces 20 Aug 06:45 e
.rw-r--r-- 0 ces 20 Aug 06:45 f
.rw-r--r-- 0 ces 20 Aug 06:45 g
.rw-r--r-- 0 ces 20 Aug 06:45 h
.rw-r--r-- 0 ces 20 Aug 06:45 i
.rw-r--r-- 0 ces 20 Aug 06:45 j
.rw-r--r-- 0 ces 20 Aug 06:45 k
.rw-r--r-- 0 ces 20 Aug 06:45 l
.rw-r--r-- 0 ces 20 Aug 06:45 m
.rw-r--r-- 0 ces 20 Aug 06:45 n
.rw-r--r-- 0 ces 20 Aug 06:45 o
.rw-r--r-- 0 ces 20 Aug 06:45 p
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l
.rw-r--r-- 0 ces 20 Aug 06:45 a
.rw-r--r-- 0 ces 20 Aug 06:45 b
.rw-r--r-- 0 ces 20 Aug 06:45 c
.rw-r--r-- 0 ces 20 Aug 06:45 d
.rw-r--r-- 0 ces 20 Aug 06:45 e
.rw-r--r-- 0 ces 20 Aug 06:45 f
.rw-r--r-- 0 ces 20 Aug 06:45 g
.rw-r--r-- 0 ces 20 Aug 06:45 h
.rw-r--r-- 0 ces 20 Aug 06:45 i
.rw-r--r-- 0 ces 20 Aug 06:45 j
.rw-r--r-- 0 ces 20 Aug 06:45 k
.rw-r--r-- 0 ces 20 Aug 06:45 l
.rw-r--r-- 0 ces 20 Aug 06:45 m
.rw-r--r-- 0 ces 20 Aug 06:45 n
.rw-r--r-- 0 ces 20 Aug 06:45 o
.rw-r--r-- 0 ces 20 Aug 06:45 p
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l
.rw-r--r-- 0 ces 20 Aug 06:45 a
.rw-r--r-- 0 ces 20 Aug 06:45 b
.rw-r--r-- 0 ces 20 Aug 06:45 c
.rw-r--r-- 0 ces 20 Aug 06:45 d
.rw-r--r-- 0 ces 20 Aug 06:45 e
.rw-r--r-- 0 ces 20 Aug 06:45 f
.rw-r--r-- 0 ces 20 Aug 06:45 g
.rw-r--r-- 0 ces 20 Aug 06:45 h
.rw-r--r-- 0 ces 20 Aug 06:45 i
.rw-r--r-- 0 ces 20 Aug 06:45 j
.rw-r--r-- 0 ces 20 Aug 06:45 k
.rw-r--r-- 0 ces 20 Aug 06:45 l
.rw-r--r-- 0 ces 20 Aug 06:45 m
.rw-r--r-- 0 ces 20 Aug 06:45 n
.rw-r--r-- 0 ces 20 Aug 06:45 o
.rw-r--r-- 0 ces 20 Aug 06:45 p
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l
.rw-r--r-- 0 ces 20 Aug 06:45 a
.rw-r--r-- 0 ces 20 Aug 06:45 b
.rw-r--r-- 0 ces 20 Aug 06:45 c
.rw-r--r-- 0 ces 20 Aug 06:45 d
.rw-r--r-- 0 ces 20 Aug 06:45 e
.rw-r--r-- 0 ces 20 Aug 06:45 f
.rw-r--r-- 0 ces 20 Aug 06:45 g
.rw-r--r-- 0 ces 20 Aug 06:45 h
.rw-r--r-- 0 ces 20 Aug 06:45 i
.rw-r--r-- 0 ces 20 Aug 06:45 j
.rw-r--r-- 0 ces 20 Aug 06:45 k
.rw-r--r-- 0 ces 20 Aug 06:45 l
.rw-r--r-- 0 ces 20 Aug 06:45 m
.rw-r--r-- 0 ces 20 Aug 06:45 n
.rw-r--r-- 0 ces 20 Aug 06:45 o
.rw-r--r-- 0 ces 20 Aug 06:45 p
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l
.rw-r--r-- 0 ces 20 Aug 06:45 a
.rw-r--r-- 0 ces 20 Aug 06:45 b
.rw-r--r-- 0 ces 20 Aug 06:45 c
.rw-r--r-- 0 ces 20 Aug 06:45 d
.rw-r--r-- 0 ces 20 Aug 06:45 e
.rw-r--r-- 0 ces 20 Aug 06:45 f
.rw-r--r-- 0 ces 20 Aug 06:45 g
.rw-r--r-- 0 ces 20 Aug 06:45 h
.rw-r--r-- 0 ces 20 Aug 06:45 i
.rw-r--r-- 0 ces 20 Aug 06:45 j
.rw-r--r-- 0 ces 20 Aug 06:45 k
.rw-r--r-- 0 ces 20 Aug 06:45 l
.rw-r--r-- 0 ces 20 Aug 06:45 m
.rw-r--r-- 0 ces 20 Aug 06:45 n
.rw-r--r-- 0 ces 20 Aug 06:45 o
.rw-r--r-- 0 ces 20 Aug 06:45 p
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l
.rw-r--r-- 0 ces 20 Aug 06:45 a
.rw-r--r-- 0 ces 20 Aug 06:45 b
.rw-r--r-- 0 ces 20 Aug 06:45 c
.rw-r--r-- 0 ces 20 Aug 06:45 d
.rw-r--r-- 0 ces 20 Aug 06:45 e
.rw-r--r-- 0 ces 20 Aug 06:45 f
.rw-r--r-- 0 ces 20 Aug 06:45 g
.rw-r--r-- 0 ces 20 Aug 06:45 h
.rw-r--r-- 0 ces 20 Aug 06:45 i
.rw-r--r-- 0 ces 20 Aug 06:45 j
.rw-r--r-- 0 ces 20 Aug 06:45 k
.rw-r--r-- 0 ces 20 Aug 06:45 l
.rw-r--r-- 0 ces 20 Aug 06:45 m
.rw-r--r-- 0 ces 20 Aug 06:45 n
.rw-r--r-- 0 ces 20 Aug 06:45 o
.rw-r--r-- 0 ces 20 Aug 06:45 p
────────────────────────────────────────────────────────────────────────────────
> cd tests/itest
> cargo run -q -- -l
.rw-r--r-- 0 ces 20 Aug 06:45 a
.rw-r--r-- 0 ces 20 Aug 06:45 b
.rw-r--r-- 0 ces 20 Aug 06:45 c
.rw-r--r-- 0 ces 20 Aug 06:45 d
.rw-r--r-- 0 ces 20 Aug 06:45 e
.rw-r--r-- 0 ces 20 Aug 06:45 f
.rw-r--r-- 0 ces 20 Aug 06:45 g
.rw-r--r-- 0 ces 20 Aug 06:45 h
.rw-r--r-- 0 ces 20 Aug 06:45 i
.rw-r--r-- 0 ces 20 Aug 06:45 j
.rw-r--r-- 0 ces 20 Aug 06:45 k
.rw-r--r-- 0 ces 20 Aug 06:45 l
.rw-r--r-- 0 ces 20 Aug 06:45 m
.rw-r--r-- 0 ces 20 Aug 06:45 n
.rw-r--r-- 0 ces 20 Aug 06:45 o
.rw-r--r-- 0 ces 20 Aug 06:45 p
────────────────────────────────────────────────────────────────────────────────

114
tests/references/main.txt Normal file
View file

@ -0,0 +1,114 @@
>
────────────────────────────────────────────────────────────────────────────────
> cargo run -q --
────────────────────────────────────────────────────────────────────────────────
> cargo run -q --
────────────────────────────────────────────────────────────────────────────────
> cargo run -q --
build.rs CONTRIBUTING.md out.gif src
Cargo.lock devtools README.md target
Cargo.toml flake.lock result tests
CHANGELOG.md flake.nix rust-toolchain.toml treefmt.nix
cliff.toml Justfile screenshots.png Vagrantfile
CODE_OF_CONDUCT.md LICENCE SECURITY.md xtests
completions man snap
>
────────────────────────────────────────────────────────────────────────────────
> cargo run -q --
build.rs CONTRIBUTING.md out.gif src
Cargo.lock devtools README.md target
Cargo.toml flake.lock result tests
CHANGELOG.md flake.nix rust-toolchain.toml treefmt.nix
cliff.toml Justfile screenshots.png Vagrantfile
CODE_OF_CONDUCT.md LICENCE SECURITY.md xtests
completions man snap
>
────────────────────────────────────────────────────────────────────────────────
> cargo run -q --
build.rs CONTRIBUTING.md out.gif src
Cargo.lock devtools README.md target
Cargo.toml flake.lock result tests
CHANGELOG.md flake.nix rust-toolchain.toml treefmt.nix
cliff.toml Justfile screenshots.png Vagrantfile
CODE_OF_CONDUCT.md LICENCE SECURITY.md xtests
completions man snap
>
────────────────────────────────────────────────────────────────────────────────

View file

@ -0,0 +1,15 @@
Output outfile
Set Shell fish
Sleep 2s
Type "cd tests/itest"
Enter
Sleep 1s
Type "cargo run -q -- -l --blocksize"
Enter
Sleep 3s
Ctrl+D

23
tests/tapes/eza-long.tape Normal file
View file

@ -0,0 +1,23 @@
Output outfile
Set Shell fish
Sleep 2s
Type "cd tests/itest"
Enter
Sleep 1s
Type "cargo run -q -- -l"
Enter
Sleep 3s
Type "cargo run -q -- -l --grid"
Enter
Sleep 3s
Type "cargo run -q -- -l --grid --icons"
Enter
Sleep 3s
Ctrl+D

10
tests/tapes/main.tape Normal file
View file

@ -0,0 +1,10 @@
Output outfile
Set Shell fish
Sleep 2s
Type "cargo run -q -- -l"
Enter
Sleep 3s
Sleep 3s
Ctrl+D

30
tests/vhs-runner.sh Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env fish
set TEST_DIR tests
set TAPES $TEST_DIR/tapes
set REFERENCES $TEST_DIR/references
set TEMP $TEST_DIR/tmp
set EZA_GREEN 0D0
set EZA_RED D00
set EZA_YELLOW DD0
function main
# Fixes command line output
echo ""
# TODO: automatic reference deletion
for file in $TAPES/*
set filename (basename $file .tape)
command fish $TEST_DIR/vhs-util.fish $filename &
end
wait
end
main

83
tests/vhs-util.fish Normal file
View file

@ -0,0 +1,83 @@
#!/usr/bin/env fish
set TEST_DIR tests
set TAPES $TEST_DIR/tapes
set REFERENCES $TEST_DIR/references
set TEMP $TEST_DIR/tmp
set EZA_GREEN 0D0
set EZA_RED D00
set EZA_YELLOW DD0
alias ffmpeg="echo skipping ffmpeg"
function print_msg -a ARG -a OP -a NAME -a MSG
# Write operator, e.g. [+]
# [*]: indicates neutral result
# [+]: indicates positive result
# [-]: indicates negative result
set_color reset
echo -n "[$OP] "
# Write source, e.g. [ blocksize ]:
set_color reset
set_color -b $ARG
set_color 000
echo -n "[ $NAME ]:"
# Write message, e.g.
set_color reset
echo " $MSG"
set_color reset
end
function run_test -d "Run VHS test" -a NAME
set FUNCTION_NAME "$NAME > run_test"
set NAME_TAPE "$NAME.tape"
set SUCCESS (print_msg "$EZA_GREEN" "+" "$FUNCTION_NAME" "Success")
set FAILURE (print_msg "$EZA_RED" "-" "$FUNCTION_NAME" "Failure")
set GEN_DIR $TEMP
set GEN_FILE $GEN_DIR/$NAME.txt
set GEN_FILE_ESCAPE (echo $GEN_FILE | sed "s/\//\\\\\//g")
print_msg $EZA_YELLOW "*" $FUNCTION_NAME "Testing..."
cat $TAPES/$NAME_TAPE | sed s/outfile/$GEN_FILE_ESCAPE/ | vhs &>/dev/null
cmp -s -- $REFERENCES/$NAME.txt $TEMP/$NAME.txt && echo $SUCCESS || echo $FAILURE
end
function gen_test -d "Generate VHS test" -a NAME
set FUNCTION_NAME "$NAME > gen_test"
set NAME_TAPE "$NAME.tape"
set SUCCESS (print_msg "$EZA_GREEN" "+" "$FUNCTION_NAME" "Success")
set FAILURE (print_msg "$EZA_RED" "-" "$FUNCTION_NAME" "Failure")
set GEN_DIR $REFERENCES
set GEN_FILE $GEN_DIR/$NAME.txt
set GEN_FILE_ESCAPE (echo $GEN_FILE | sed "s/\//\\\\\//g")
# The idea behind this is that it makes it easier for users of this system
# to change the reference. They should now only have to delete the old
# reference, and a new one will be generated.
if builtin test -f $GEN_FILE
print_msg $EZA_GREEN "+" $FUNCTION_NAME "$GEN_FILE exists"
return
end
print_msg $EZA_YELLOW "*" $FUNCTION_NAME "Generating..."
cat $TAPES/$NAME_TAPE | sed s/outfile/$GEN_FILE_ESCAPE/ | vhs &>/dev/null && echo $SUCCESS || echo $FAILURE
end
gen_test $argv[1]
run_test $argv[1]