pantry/projects/github.com/zsh-users/zsh-syntax-highlighting/fixture.sh
Sanchit Ram Arvind 2e21805050
+zsh-syntax-highlighting (#2000)
* +zsh-syntax-highlighting

* Removed $HOME

You'd still have to run a command yourself post installation.

* added test

* missing fixture

* no executable

* clean up

* comment out user message in build script

* don't need gum

---------

Co-authored-by: Jacob Heider <jacob@tea.xyz>
2023-05-24 22:39:40 -04:00

30 lines
689 B
Bash

#!/bin/bash
# Receive the directory as the first command-line argument
directory="$1"
# Check if the directory is provided
if [ -z "$directory" ]; then
echo "Directory parameter is missing."
exit 1
fi
# Change to the specified directory
cd "$directory" || { echo "Failed to change to the specified directory."; exit 1; }
# Run the test & read the lines
output=$(zsh tests/test-highlighting.zsh main)
lines=()
while IFS= read -r line; do
lines+=("$line")
done <<< "$output"
# If line has 'not ok', with no '#TODO' --> fail & exit
for line in "${lines[@]}"; do
if [[ $line =~ ^(.*\bnot ok\b)(.*)$ && ! $line =~ "#TODO" ]]; then
echo "Fail"
exit 1
fi
done
echo "Pass"