Add a test for traceback correctness for errors in augmented assignment nodes
PiperOrigin-RevId: 169942209
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 67f691e..081f1ad 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
@@ -392,6 +392,25 @@
}
@Test
+ public void testStackTraceWithAugmentedAssignment() throws Exception {
+ new SkylarkTest()
+ .testIfErrorContains(
+ "File \"\", line 4"
+ + LINE_SEPARATOR
+ + "\t\tfoo()"
+ + LINE_SEPARATOR
+ + "\tFile \"\", line 3, in foo"
+ + LINE_SEPARATOR
+ + "\t\ts += \"2\""
+ + LINE_SEPARATOR
+ + "unsupported operand type(s) for +: 'int' and 'string'",
+ "def foo():",
+ " s = 1",
+ " s += '2'",
+ "foo()");
+ }
+
+ @Test
public void testStackTraceSkipBuiltInOnly() throws Exception {
// The error message should not include the stack trace when there is
// only one built-in function.