aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/skylark/SkylarkCommandLineTest.java
diff options
context:
space:
mode:
authorGravatar Han-Wen Nienhuys <hanwen@google.com>2015-09-22 16:24:45 +0000
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2015-09-22 17:19:53 +0000
commitceae8c50e8f92c6fbf2394ac7c5eb3b420539225 (patch)
tree9b10bab2b8e06b61ff268a422ee2f27e09f10382 /src/test/java/com/google/devtools/build/lib/skylark/SkylarkCommandLineTest.java
parent4671896be8bf0e37c85c3b740bb3621d2a9e1cc8 (diff)
Open source some skylark tests.
-- MOS_MIGRATED_REVID=103652672
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/skylark/SkylarkCommandLineTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/skylark/SkylarkCommandLineTest.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/skylark/SkylarkCommandLineTest.java b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkCommandLineTest.java
new file mode 100644
index 0000000000..c0e6ad0ed9
--- /dev/null
+++ b/src/test/java/com/google/devtools/build/lib/skylark/SkylarkCommandLineTest.java
@@ -0,0 +1,47 @@
+// Copyright 2014 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.devtools.build.lib.skylark;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import com.google.devtools.build.lib.skylark.util.SkylarkTestCase;
+import com.google.devtools.build.lib.syntax.SkylarkList;
+
+/**
+ * Tests for {@link SkylarkCommandLine}.
+ */
+public class SkylarkCommandLineTest extends SkylarkTestCase {
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ scratch.file(
+ "foo/BUILD",
+ "genrule(name = 'foo',",
+ " cmd = 'dummy_cmd',",
+ " srcs = ['a.txt', 'b.img'],",
+ " tools = ['t.exe'],",
+ " outs = ['c.txt'])");
+ }
+
+ public void testCmdHelperAll() throws Exception {
+ Object result =
+ evalRuleContextCode(
+ createRuleContext("//foo:foo"),
+ "cmd_helper.template(set(ruleContext.files.srcs), '--%{short_path}=%{path}')");
+ SkylarkList list = (SkylarkList) result;
+ assertThat(list).containsExactly("--foo/a.txt=foo/a.txt", "--foo/b.img=foo/b.img").inOrder();
+ }
+}