diff --git a/e2e/binary/comm/BUILD.bazel b/e2e/binary/comm/BUILD.bazel index c1c3dd563b2ca4b17152af53e505d6bf590537b5..7b003782958e61a07ce7cb1c88adf157b713b164 100644 --- a/e2e/binary/comm/BUILD.bazel +++ b/e2e/binary/comm/BUILD.bazel @@ -1,11 +1,33 @@ -load("@bazel_skylib//rules:build_test.bzl", "build_test") +load("@bazel_skylib//rules:native_binary.bzl", "native_test") +load("@rules_python_pytest//python_pytest:defs.bzl", "py_pytest_test") -# TODO: write an _actual_ test for `comm` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["comm.py"], + data = [ + "a.txt", + "b.txt", + "expected.txt", + "@ape//ape:comm", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( - name = "comm", +native_test( + name = "version", size = "small", - tags = ["stub"], - targets = ["@ape//ape:comm"], - visibility = ["//:__subpackages__"], + src = "@ape//ape:comm", + args = ["--version"], ) + +test_suite( + name = "comm", + tests = [ + "pytest", + "version", + ], + visibility = ["//:__subpackages__"], +) \ No newline at end of file diff --git a/e2e/binary/comm/a.txt b/e2e/binary/comm/a.txt new file mode 100644 index 0000000000000000000000000000000000000000..0a207c060e61f3b88eaee0a8cd0696f46fb155eb --- /dev/null +++ b/e2e/binary/comm/a.txt @@ -0,0 +1,2 @@ +a +b \ No newline at end of file diff --git a/e2e/binary/comm/b.txt b/e2e/binary/comm/b.txt new file mode 100644 index 0000000000000000000000000000000000000000..63d8dbd40c23542e740659a7168a0ce3138ea748 --- /dev/null +++ b/e2e/binary/comm/b.txt @@ -0,0 +1 @@ +b \ No newline at end of file diff --git a/e2e/binary/comm/comm.py b/e2e/binary/comm/comm.py new file mode 100644 index 0000000000000000000000000000000000000000..909f0bed9a56c9bc0bad1c3d6ce677af3eda7d29 --- /dev/null +++ b/e2e/binary/comm/comm.py @@ -0,0 +1,19 @@ +from __future__ import annotations + +from pathlib import Path +from subprocess import run + +from binary import Diff, Relative, Tool + + +def test_comm(tool: Tool, relative: Relative, tmp_path: Path) -> None: + binary = tool("comm") + a = relative("a.txt") + b = relative("b.txt") + expected = relative("expected.txt") + output = tmp_path / "output.txt" + + cmd = (binary, "-1", "-2", a, b) + with open(output, "w") as stream: + run(cmd, check=True, timeout=30, stdout=stream) + assert Diff(expected) == Diff(output) \ No newline at end of file diff --git a/e2e/binary/comm/expected.txt b/e2e/binary/comm/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..61780798228d17af2d34fce4cfbdf35556832472 --- /dev/null +++ b/e2e/binary/comm/expected.txt @@ -0,0 +1 @@ +b