Skip to content

Commit

Permalink
Improve misc readability & context in test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
victor-gp committed Jul 23, 2022
1 parent 0af2926 commit 3845f9e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# only used for bat-test.dockerfile
# only used for tests/docker/bat-test.dockerfile

*
!/syntaxes/
Expand Down
2 changes: 1 addition & 1 deletion tests/docker/bat-test.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# usage: through highlight_regression.sh and theme_regression.sh
# usage: through tests/highlight_regression.sh and tests/theme_regression.sh

FROM curlimages/curl:latest AS fetch-pkg
LABEL keep=false
Expand Down
2 changes: 1 addition & 1 deletion tests/docker/syntest.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# usage: use syntax.py, don't run this manually
# usage: use tests/syntax.py, don't run this manually

FROM rust:1.59 as build
LABEL keep=false
Expand Down
1 change: 1 addition & 0 deletions tests/highlight_regression.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ docker build --quiet -f docker/bat-test.dockerfile -t bat-test ..

vol1="$PWD"/source:/tests/source:ro
vol2="$PWD"/highlighted:/tests/highlighted

docker run --rm \
-v "$vol1" -v "$vol2" \
bat-test
Expand Down
9 changes: 5 additions & 4 deletions tests/syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

dockerfile_path = 'docker/syntest.dockerfile'
image_tag = 'syntest'
tests_path = '/tests/syntax'
tests_dir = '/tests/syntax'
syntaxes_path = '/syntaxes'
volumes = f'-v="$PWD/syntax":{tests_path} -v="$PWD/../syntaxes":{syntaxes_path}'
volumes = f'-v="$PWD/syntax":{tests_dir} -v="$PWD/../syntaxes":{syntaxes_path}'

### cli

Expand Down Expand Up @@ -42,11 +42,12 @@
stderr=subprocess.DEVNULL
)
if ret != 0: # image doesn't exist
print("\033[34m" + "Image not available, building syntest from source..." + "\033[00m")
print("\033[34m" + "Docker image not available, building syntest from source..." + "\033[00m")
subprocess.call(
f"docker build -t {image_tag} - < {dockerfile_path}",
shell=True
)
print("\033[34m" + "Docker build ends here." + "\033[00m")

man_syntax_path = Path('../syntaxes/Manpage.sublime-syntax')
if not man_syntax_path.is_file():
Expand All @@ -58,7 +59,7 @@

### arrange arguments

args = f"{script_args.test_path or tests_path} {syntaxes_path}"
args = f"{script_args.test_path or tests_dir} {syntaxes_path}"
if script_args.debug:
args += " --debug"
if script_args.summary:
Expand Down
1 change: 1 addition & 0 deletions tests/theme_regression.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ docker build --quiet -f docker/bat-test.dockerfile -t bat-test ..

vol1="$PWD"/source:/tests/source:ro
vol2="$PWD"/theme:/tests/theme

docker run --rm \
-v "$vol1" -v "$vol2" \
--entrypoint /tests/run_theme_regression.sh \
Expand Down

0 comments on commit 3845f9e

Please sign in to comment.