diff --git a/e2e/binary/dir/BUILD.bazel b/e2e/binary/dir/BUILD.bazel index 3249d822bd43f674c66696ac910e8f48ce9847d6..bddf96c4098c134dcedd1e9939886f1e7657b806 100644 --- a/e2e/binary/dir/BUILD.bazel +++ b/e2e/binary/dir/BUILD.bazel @@ -1,11 +1,30 @@ -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 `dir` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["dir.py"], + data = [ + "expected.txt", + "@ape//ape:dir", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( - name = "dir", +native_test( + name = "native", size = "small", - tags = ["stub"], - targets = ["@ape//ape:dir"], - visibility = ["//:__subpackages__"], + src = "@ape//ape:dir", ) + +test_suite( + name = "dir", + tests = [ + "pytest", + "native", + ], + visibility = ["//:__subpackages__"], +) \ No newline at end of file diff --git a/e2e/binary/dir/dir.py b/e2e/binary/dir/dir.py new file mode 100644 index 0000000000000000000000000000000000000000..1f060e31153efd93f6921ea76d8bcd7bb0c25363 --- /dev/null +++ b/e2e/binary/dir/dir.py @@ -0,0 +1,17 @@ +from __future__ import annotations + +from pathlib import Path +from subprocess import run + +from binary import Relative, Tool, Diff + + +def test_dir(tool: Tool, relative: Relative, tmp_path: Path) -> None: + binary = tool("dir") + expected = relative("expected.txt") + output = tmp_path / "output.txt" + + cmd = (binary, tmp_path) + with open(output, "w", encoding="utf-8") as stream: + run(cmd, check=True, timeout=30, stdout=stream) + assert Diff(expected) == Diff(output) diff --git a/e2e/binary/dir/expected.txt b/e2e/binary/dir/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..8617481f53306378fb27a7abd9b51efdeedda995 --- /dev/null +++ b/e2e/binary/dir/expected.txt @@ -0,0 +1 @@ +output.txt