diff --git a/e2e/binary/emacs/BUILD.bazel b/e2e/binary/emacs/BUILD.bazel index 81af26c7263b618510b3c9a5188af238f3a36f0a..c4582ce756a6fb2198dbb7e9f02776b10fef4fbb 100644 --- a/e2e/binary/emacs/BUILD.bazel +++ b/e2e/binary/emacs/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 `emacs` +py_pytest_test( + name = "pytest", + size = "small", + srcs = ["emacs.py"], + data = [ + "@ape//ape:emacs", + ], + deps = [ + "//binary:pytest", + ], +) -build_test( - name = "emacs", +native_test( + name = "version", size = "small", - tags = ["stub"], - targets = ["@ape//ape:emacs"], + src = "@ape//ape:emacs", + args = ["--version"], +) + +test_suite( + name = "emacs", + tests = [ + "pytest", + "version", + ], visibility = ["//:__subpackages__"], ) diff --git a/e2e/binary/emacs/emacs.py b/e2e/binary/emacs/emacs.py new file mode 100644 index 0000000000000000000000000000000000000000..1877efb8d71c176c4f0a9d6597aa53438b40a0df --- /dev/null +++ b/e2e/binary/emacs/emacs.py @@ -0,0 +1,14 @@ +from __future__ import annotations + +from pathlib import Path +from subprocess import run, PIPE + +from binary import Diff, Relative, Tool + + +def test_emacs(tool: Tool, relative: Relative, tmp_path: Path) -> None: + binary = tool("emacs") + + cmd = (binary, "--batch", "--eval=(prin1 \"Hello, world!\")") + result = run(cmd, check=True, timeout=30, capture_output=True, text=True) + assert "\"Hello, world!\"" == result.stdout