diff --git a/e2e/binary/date/BUILD.bazel b/e2e/binary/date/BUILD.bazel index cdef4d4c7d2e51078e75e5e765a33ca175b318d6..bcf7329208d535bc754d5f47aa485459f5dd52b1 100644 --- a/e2e/binary/date/BUILD.bazel +++ b/e2e/binary/date/BUILD.bazel @@ -1,11 +1,30 @@ -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 `date` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["date.py"], + data = [ + "expected.txt", + "@ape//ape:date", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( - name = "date", +native_test( + name = "native", size = "small", - tags = ["stub"], - targets = ["@ape//ape:date"], - visibility = ["//:__subpackages__"], + src = "@ape//ape:date", ) + +test_suite( + name = "date", + tests = [ + "pytest", + "native", + ], + visibility = ["//:__subpackages__"], +) \ No newline at end of file diff --git a/e2e/binary/date/date.py b/e2e/binary/date/date.py new file mode 100644 index 0000000000000000000000000000000000000000..6613fa4688c3b5bfc189c61ac63263b315be6c3f --- /dev/null +++ b/e2e/binary/date/date.py @@ -0,0 +1,17 @@ +from __future__ import annotations + +from pathlib import Path +from subprocess import run + +from binary import Diff, Relative, Tool + + +def test_date(tool: Tool, relative: Relative, tmp_path: Path) -> None: + binary = tool("date") + expected = relative("expected.txt") + output = tmp_path / "output.txt" + + cmd = (binary, "+Hello, world") + 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/date/expected.txt b/e2e/binary/date/expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..a5c19667710254f835085b99726e523457150e03 --- /dev/null +++ b/e2e/binary/date/expected.txt @@ -0,0 +1 @@ +Hello, world