diff --git a/e2e/binary/expand/BUILD.bazel b/e2e/binary/expand/BUILD.bazel index 2a3ea4083461eb58551ea41a86ac47a6d7874ef9..f5ff887623f77028268d172ae3d904bfb5830cd3 100644 --- a/e2e/binary/expand/BUILD.bazel +++ b/e2e/binary/expand/BUILD.bazel @@ -1,11 +1,32 @@ -load("@bazel_skylib//rules:build_test.bzl", "build_test") +load("@rules_python_pytest//python_pytest:defs.bzl", "py_pytest_test") +load("@bazel_skylib//rules:native_binary.bzl", "native_test") -# TODO: write an _actual_ test for `expand` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["expand.py"], + data = [ + "fixture.txt", + "expected.txt", + "@ape//ape:expand", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( - name = "expand", +native_test( + name = "version", size = "small", - tags = ["stub"], - targets = ["@ape//ape:expand"], + src = "@ape//ape:expand", + args = ["--version"], +) + +test_suite( + name = "expand", + tests = [ + "pytest", + "version", + ], visibility = ["//:__subpackages__"], ) diff --git a/e2e/binary/expand/expand.py b/e2e/binary/expand/expand.py new file mode 100644 index 0000000000000000000000000000000000000000..827ed8e26081b9c6f360a34cd565b5c7f2ac78da --- /dev/null +++ b/e2e/binary/expand/expand.py @@ -0,0 +1,18 @@ +from __future__ import annotations + +from pathlib import Path +from subprocess import run + +from binary import Diff, Relative, Tool + + +def test_expand(tool: Tool, relative: Relative, tmp_path: Path) -> None: + binary = tool("expand") + fixture = relative("fixture.txt") + expected = relative("expected.txt") + output = tmp_path / "output.txt" + + cmd = (binary, fixture) + with open(output, "w") as stream: + run(cmd, check=True, timeout=30, stdout=stream) + assert Diff(expected) == Diff(output) diff --git a/e2e/binary/expand/expected.txt b/e2e/binary/expand/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..fbb6a06c2b67c9eaa09b638a608aa28272f8755f --- /dev/null +++ b/e2e/binary/expand/expected.txt @@ -0,0 +1 @@ + Tabs To Spaces \ No newline at end of file diff --git a/e2e/binary/expand/fixture.txt b/e2e/binary/expand/fixture.txt new file mode 100644 index 0000000000000000000000000000000000000000..f47d2291ada542a26fc8b2728c4d0d2d07226da8 --- /dev/null +++ b/e2e/binary/expand/fixture.txt @@ -0,0 +1 @@ + Tabs To Spaces \ No newline at end of file