Fix bug in S_MOD

This commit is contained in:
Nunuhara Cabbage
2019-11-18 21:53:51 -08:00
parent 70ab217ca0
commit 00c4e7bf1f
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -471,6 +471,7 @@ struct string *string_format(struct string *fmt, union vm_value arg)
parse_fmt_spec(&s, &spec);
append_fmt(&out, &spec, arg);
string_append_cstr(&out, s, strlen(s));
break;
}
}
return out;
+1
View File
@@ -72,6 +72,7 @@ void test_strings(void)
test_string("abc%Ddef % 42", "abc%Ddef" % 42, "abc42def");
test_string("abc%4Ddef % 42", "abc%4Ddef" % 42, "abc  42def");
test_string("abc%04Ddef % 42", "abc%04Ddef" % 42, "abc0042def");
test_string("\"%d %d\" % 42 % 43", "%d %d" % 42 % 43, "42 43");
// float
test_string("abc%fdef % 12.3", "abc%fdef" % 12.3, "abc12.300000def");
test_string("abc%.2fdef % 12.3", "abc%.2fdef" % 12.3, "abc12.30def");