aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/skylark/BUILD
blob: a3e1c5afdd697830b9f9d9dc149c4eaed71aa480 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
load(
    "//tools/build_rules:test_rules.bzl",
    "rule_test",
    "file_test",
)

package(default_visibility = ["//src:__subpackages__"])

filegroup(
    name = "srcs",
    srcs = glob(["**"]) + ["//src/test/skylark/skylint:srcs"],
)

[
    py_test(
        name = "skylark_test_" + test_file.replace(".", "_"),
        srcs = [
            "skylark_test.py",
            "testenv.py",
        ],
        args = [test_file],
        data = [
            "//src/main/java/com/google/devtools/skylark:Skylark",
            test_file,
        ],
        main = "skylark_test.py",
    )
    for test_file in glob(["testdata/*"])
]

## Rest of the file should be moved somewhere else (under bazel/tools/).

genrule(
    name = "tone_below",
    outs = [
        "g1",
        "g2",
    ],
    cmd = "echo 48.9994 > $(location :g1) ; echo 97.9989 > $(location :g2)",
)

rule_test(
    name = "assert_tone_below_1",
    generates = [
        "g1",
        "g2",
    ],
    rule = "tone_below",
)

file_test(
    name = "question_content",
    content = ("If you could ask a unique question to a computer during a Turing test, " +
               "what would you ask?\n"),
    file = "question.text",
)

file_test(
    name = "question_regexp",
    file = "question.text",
    regexp = "[eu]n[uchs questi]\\+on",
)

file_test(
    name = "question_regexp_1",
    file = "question.text",
    matches = 1,
    regexp = "what would you ask",
)