Skip to content

Commit

Permalink
Add unit test for --version
Browse files Browse the repository at this point in the history
  • Loading branch information
deeplow committed Dec 23, 2022
1 parent 1473708 commit cc7ffac
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import contextlib
import copy
import os
import re
import shutil
import sys
import tempfile
Expand Down Expand Up @@ -163,6 +164,17 @@ def test_display_banner(self, capfd) -> None: # type: ignore[no-untyped-def]
for line in plain_lines:
assert len(line) == banner_width, "banner has inconsistent width"

def test_version(self) -> None:
result = self.run_cli("--version")
result.assert_success()

with open("share/version.txt") as f:
valid_version_regex = r"\d+\.\d+\.\d+"
version = f.read().strip()

assert re.match(valid_version_regex, version)
assert version in result.stdout


class TestCliConversion(TestCliBasic):
def test_invalid_lang(self) -> None:
Expand Down

0 comments on commit cc7ffac

Please sign in to comment.