| # Copyright 2024 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| load("@bazel_skylib//rules:diff_test.bzl", "diff_test") |
| load("@pip//:requirements.bzl", "requirement") |
| load("@rules_python//python:defs.bzl", "py_binary") |
| load(":expand_template.bzl", "expand_template") |
| |
| py_binary( |
| name = "expand_template", |
| srcs = ["expand_template.py"], |
| visibility = ["//visibility:public"], |
| deps = [ |
| requirement("jinja2"), |
| ], |
| ) |
| |
| expand_template( |
| name = "simple_json", |
| template = "testdata/simple.jinja2", |
| vars_file = "testdata/simple.in.json", |
| ) |
| |
| diff_test( |
| name = "simple_json_test", |
| file1 = ":simple_json", |
| file2 = "testdata/simple.out", |
| ) |
| |
| expand_template( |
| name = "simple_vars", |
| template = "testdata/simple.jinja2", |
| vars = { |
| "foo": "bar", |
| }, |
| ) |
| |
| diff_test( |
| name = "simple_vars_test", |
| file1 = ":simple_vars", |
| file2 = "testdata/simple.out", |
| ) |