Skylark: Add lstrip and rstrip functions. -- MOS_MIGRATED_REVID=105498175
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java b/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java index de92681..7c0828b 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java
@@ -1,4 +1,4 @@ -// Copyright 2006 Google Inc. All Rights Reserved. +// Copyright 2006 The Bazel Authors. 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. @@ -977,13 +977,6 @@ } @Test - public void testStrip() throws Exception { - new BothModesTest() - .testStatement("' abc\t'.strip()", "abc") - .testStatement("'abc '.strip()", "abc"); - } - - @Test public void testBool() throws Exception { new BothModesTest() .testStatement("bool(1)", Boolean.TRUE) @@ -1097,4 +1090,33 @@ .testStatement("'A'.isalpha()", true) .testStatement("'AbZ'.isalpha()", true); } + + @Test + public void testLStrip() throws Exception { + new BothModesTest() + .testStatement("'abc'.lstrip('')", "abc") + .testStatement("'abcba'.lstrip('ba')", "cba") + .testStatement("'abc'.lstrip('xyz')", "abc") + .testStatement("' abc '.lstrip()", "abc "); + } + + @Test + public void testRStrip() throws Exception { + new BothModesTest() + .testStatement("'abc'.rstrip('')", "abc") + .testStatement("'abcba'.rstrip('ba')", "abc") + .testStatement("'abc'.rstrip('xyz')", "abc") + .testStatement("' abc '.rstrip()", " abc"); + } + + @Test + public void testStrip() throws Exception { + new BothModesTest() + .testStatement("'abc'.strip('')", "abc") + .testStatement("'abcba'.strip('ba')", "c") + .testStatement("'abc'.strip('xyz')", "abc") + .testStatement("' abc '.strip()", "abc") + .testStatement("' abc\t'.strip()", "abc") + .testStatement("'abc'.strip('.')", "abc"); + } }