load("@bazel_skylib//rules:diff_test.bzl", "diff_test") load("@bazel_skylib//rules:write_file.bzl", "write_file") write_file( name = "a", out = "a.txt", content = [ "foobar", ], ) write_file( name = "b", out = "b.txt", content = [ "moocow", ], ) write_file( name = "expected", out = "expected.txt", content = [ "1c1", "< foobar", "\\ No newline at end of file", "---", "> moocow", "\\ No newline at end of file", "", ], ) genrule( name = "patch", srcs = [ ":a", ":b", ], outs = ["patch.patch"], cmd = "$(execpath //:diff) $(execpath :a) $(execpath :b) > $@ || true", tools = ["//:diff"], ) diff_test( name = "test", file1 = ":expected", file2 = ":patch", )