diff options
Diffstat (limited to 'src/test/compile-fail/ifmt-bad-arg.rs')
| -rw-r--r-- | src/test/compile-fail/ifmt-bad-arg.rs | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/src/test/compile-fail/ifmt-bad-arg.rs b/src/test/compile-fail/ifmt-bad-arg.rs index 875ad0d2b62..273394794a9 100644 --- a/src/test/compile-fail/ifmt-bad-arg.rs +++ b/src/test/compile-fail/ifmt-bad-arg.rs @@ -9,66 +9,66 @@ // except according to those terms. fn main() { - // bad arguments to the ifmt! call + // bad arguments to the format! call - ifmt!(); //~ ERROR: expects at least one - ifmt!("{}"); //~ ERROR: invalid reference to argument + format!(); //~ ERROR: requires at least a format string + format!("{}"); //~ ERROR: invalid reference to argument - ifmt!("{1}", 1); //~ ERROR: invalid reference to argument `1` + format!("{1}", 1); //~ ERROR: invalid reference to argument `1` //~^ ERROR: argument never used - ifmt!("{foo}"); //~ ERROR: no argument named `foo` + format!("{foo}"); //~ ERROR: no argument named `foo` - ifmt!("{}", 1, 2); //~ ERROR: argument never used - ifmt!("{1}", 1, 2); //~ ERROR: argument never used - ifmt!("{}", 1, foo=2); //~ ERROR: named argument never used - ifmt!("{foo}", 1, foo=2); //~ ERROR: argument never used - ifmt!("", foo=2); //~ ERROR: named argument never used + format!("{}", 1, 2); //~ ERROR: argument never used + format!("{1}", 1, 2); //~ ERROR: argument never used + format!("{}", 1, foo=2); //~ ERROR: named argument never used + format!("{foo}", 1, foo=2); //~ ERROR: argument never used + format!("", foo=2); //~ ERROR: named argument never used - ifmt!("{0:d} {0:s}", 1); //~ ERROR: redeclared with type `s` - ifmt!("{foo:d} {foo:s}", foo=1); //~ ERROR: redeclared with type `s` + format!("{0:d} {0:s}", 1); //~ ERROR: redeclared with type `s` + format!("{foo:d} {foo:s}", foo=1); //~ ERROR: redeclared with type `s` - ifmt!("{foo}", foo=1, foo=2); //~ ERROR: duplicate argument - ifmt!("#"); //~ ERROR: `#` reference used - ifmt!("", foo=1, 2); //~ ERROR: positional arguments cannot follow - ifmt!("" 1); //~ ERROR: expected token: `,` - ifmt!("", 1 1); //~ ERROR: expected token: `,` + format!("{foo}", foo=1, foo=2); //~ ERROR: duplicate argument + format!("#"); //~ ERROR: `#` reference used + format!("", foo=1, 2); //~ ERROR: positional arguments cannot follow + format!("" 1); //~ ERROR: expected token: `,` + format!("", 1 1); //~ ERROR: expected token: `,` - ifmt!("{0, select, a{} a{} other{}}", "a"); //~ ERROR: duplicate selector - ifmt!("{0, plural, =1{} =1{} other{}}", 1u); //~ ERROR: duplicate selector - ifmt!("{0, plural, one{} one{} other{}}", 1u); //~ ERROR: duplicate selector + format!("{0, select, a{} a{} other{}}", "a"); //~ ERROR: duplicate selector + format!("{0, plural, =1{} =1{} other{}}", 1u); //~ ERROR: duplicate selector + format!("{0, plural, one{} one{} other{}}", 1u); //~ ERROR: duplicate selector // bad syntax of the format string - ifmt!("{"); //~ ERROR: unterminated format string - ifmt!("\\ "); //~ ERROR: invalid escape - ifmt!("\\"); //~ ERROR: expected an escape + format!("{"); //~ ERROR: unterminated format string + format!("\\ "); //~ ERROR: invalid escape + format!("\\"); //~ ERROR: expected an escape - ifmt!("{0, }", 1); //~ ERROR: expected method - ifmt!("{0, foo}", 1); //~ ERROR: unknown method - ifmt!("{0, select}", "a"); //~ ERROR: must be followed by - ifmt!("{0, plural}", 1); //~ ERROR: must be followed by + format!("{0, }", 1); //~ ERROR: expected method + format!("{0, foo}", 1); //~ ERROR: unknown method + format!("{0, select}", "a"); //~ ERROR: must be followed by + format!("{0, plural}", 1); //~ ERROR: must be followed by - ifmt!("{0, select, a{{}", 1); //~ ERROR: must be terminated - ifmt!("{0, select, {} other{}}", "a"); //~ ERROR: empty selector - ifmt!("{0, select, other{} other{}}", "a"); //~ ERROR: multiple `other` - ifmt!("{0, plural, offset: other{}}", "a"); //~ ERROR: must be an integer - ifmt!("{0, plural, offset 1 other{}}", "a"); //~ ERROR: be followed by `:` - ifmt!("{0, plural, =a{} other{}}", "a"); //~ ERROR: followed by an integer - ifmt!("{0, plural, a{} other{}}", "a"); //~ ERROR: unexpected plural - ifmt!("{0, select, a{}}", "a"); //~ ERROR: must provide an `other` - ifmt!("{0, plural, =1{}}", "a"); //~ ERROR: must provide an `other` + format!("{0, select, a{{}", 1); //~ ERROR: must be terminated + format!("{0, select, {} other{}}", "a"); //~ ERROR: empty selector + format!("{0, select, other{} other{}}", "a"); //~ ERROR: multiple `other` + format!("{0, plural, offset: other{}}", "a"); //~ ERROR: must be an integer + format!("{0, plural, offset 1 other{}}", "a"); //~ ERROR: be followed by `:` + format!("{0, plural, =a{} other{}}", "a"); //~ ERROR: followed by an integer + format!("{0, plural, a{} other{}}", "a"); //~ ERROR: unexpected plural + format!("{0, select, a{}}", "a"); //~ ERROR: must provide an `other` + format!("{0, plural, =1{}}", "a"); //~ ERROR: must provide an `other` - ifmt!("{0, plural, other{{0:s}}}", "a"); //~ ERROR: previously used as - ifmt!("{:s} {0, plural, other{}}", "a"); //~ ERROR: argument used to - ifmt!("{0, select, other{}} \ - {0, plural, other{}}", "a"); + format!("{0, plural, other{{0:s}}}", "a"); //~ ERROR: previously used as + format!("{:s} {0, plural, other{}}", "a"); //~ ERROR: argument used to + format!("{0, select, other{}} \ + {0, plural, other{}}", "a"); //~^ ERROR: declared with multiple formats // It should be illegal to use implicit placement arguments nested inside of // format strings because otherwise the "internal pointer of which argument // is next" would be invalidated if different cases had different numbers of // arguments. - ifmt!("{0, select, other{{}}}", "a"); //~ ERROR: cannot use implicit - ifmt!("{0, plural, other{{}}}", 1); //~ ERROR: cannot use implicit - ifmt!("{0, plural, other{{1:.*d}}}", 1, 2); //~ ERROR: cannot use implicit + format!("{0, select, other{{}}}", "a"); //~ ERROR: cannot use implicit + format!("{0, plural, other{{}}}", 1); //~ ERROR: cannot use implicit + format!("{0, plural, other{{1:.*d}}}", 1, 2); //~ ERROR: cannot use implicit } |
