Skip to content

Commit 365e869

Browse files
author
Pavel Marek
committed
Add sprintf tests where args contain empty vector.
1 parent 62debd8 commit 365e869

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_sprintf.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ public void testSprintf() {
180180
assertEval("{ sprintf('% g', 4.33) }");
181181
assertEval("{ sprintf('%g', 4.3345423) }");
182182

183+
// If one of args is NULL or an empty vector, sprintf should produce character(0).
184+
assertEval("{ sprintf('%s%d', 'Hello', c()) }");
185+
assertEval("{ sprintf('%s%d', 'Hello', NULL) }");
186+
assertEval("{ sprintf('%d%s', NULL, 'Hello') }");
187+
assertEval("{ sprintf('%s%d', 'Hello', seq_along(c())) }");
188+
183189
assertEval(Ignored.ImplementationError, "{ sprintf('%#g', 4.0) }");
184190
}
185191

0 commit comments

Comments
 (0)