1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-10-30 14:43:57 +00:00

Modified snapshot tests to support tab expansion.

This changes how the files are named (to allow for snapshots that aren't
directly related to the --style argument) and fixes the
generate_snapshots.py script to work with the latest version of bat.

Three new tests are also introduced:
- tabs_4 - Tab expansion with a width of 4.
- tabs_8 - Tab expansion with a width of 8.
- tabs_passthrough - No tab expansion.
This commit is contained in:
eth-p
2018-09-10 19:19:43 -07:00
parent b23ff24ebc
commit 9159341714
5 changed files with 68 additions and 28 deletions

View File

@@ -10,16 +10,24 @@ def generate_snapshots():
for num in range(len(single_styles)):
for grouped in itertools.combinations(single_styles, num + 1):
generate_snapshot(",".join(grouped))
generate_style_snapshot(",".join(grouped))
for style in collective_styles:
generate_snapshot(style)
generate_style_snapshot(style)
def generate_snapshot(option):
command = "../../target/debug/bat --style={0} sample.rs > output/{0}.snapshot.txt".format(
option
generate_snapshot("tabs_passthrough", "--tabs=0 --style=full")
generate_snapshot("tabs_4", "--tabs=4 --style=full")
generate_snapshot("tabs_8", "--tabs=8 --style=full")
def generate_style_snapshot(style):
generate_snapshot(style.replace(",","_"), "--style={}".format(style))
def generate_snapshot(name, arguments):
command = "../../target/debug/bat --decorations=always {1} sample.rs > output/{0}.snapshot.txt".format(
name,
arguments
)
print("generating snapshot for {}".format(option))
print("generating snapshot for {}".format(name))
subprocess.call(command, shell=True)
def build_bat():