Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

String formatter - Added failing unit test for missing-named-argument…

… feature.
  • Loading branch information...
commit d667c49f8fadd6a58dece7ef53a8981e63483a11 1 parent 09b7507
@dcporter dcporter authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 frameworks/runtime/tests/system/string.js
View
7 frameworks/runtime/tests/system/string.js
@@ -7,6 +7,9 @@
/*globals module test ok isObj equals expects */
+// Note that these unit tests are calling SC.String.fmt directly, which has a different
+// signature than String.prototype.fmt does.
+
module("String Formatting");
test("Passing ordered arguments", function() {
equals(SC.String.fmt("%@, %@%@", ["Hello", "World", "!"]), "Hello, World!");
@@ -24,6 +27,10 @@ test("Passing named arguments", function() {
]), "Hello, World!");
});
+test("Passing incomplete named arguments", function() {
+ equals( SC.String.fmt("%{first}, %{last}%{punctuation}", [{first: 'Hello', punctuation: '!'}]), "Hello, %{last}!", "Formatting a string with an incomplete set of named arguments should leave unspecified named arguments in place." );
+})
+
test("Passing arguments with formatters", function() {
var F = function(value) {
return "$" + value;
Please sign in to comment.
Something went wrong with that request. Please try again.