load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files") load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") load("//test/snapshot:snapshot.bzl", "generate_snapshots") go_library( name = "snapshot", srcs = [ "diff.go", "doc.go", "snapshot.go", ], importpath = "edge-infra.dev/test/snapshot", visibility = ["//visibility:public"], deps = [ "@com_github_pmezard_go_difflib//difflib", "@com_github_stretchr_testify//assert", ], ) go_test( name = "snapshot_test", srcs = ["snapshot_test.go"], data = glob(["testdata/**"]), embed = [":snapshot"], ) generate_snapshots( name = "snapshot_lib_snapshots", testonly = True, srcs = glob(["testdata/**"]), snapshot_path = "test/snapshot/testdata/snapshots", snapshot_test = ":snapshot_test", ) write_source_files( name = "update_snapshots_snapshot_lib", testonly = True, files = { "testdata/snapshots": ":snapshot_lib_snapshots", }, )