Rocket/core/codegen/tests/compile-fail/form-field-attr.rs
Sergio Benitez f171dc9d09 Reorganize repository.
The directory structure has changed to better isolate crates serving
core and contrib. The new directory structure is:

  contrib/
    lib/ - the contrib library
  core/
    lib/ - the core Rocket library
    codegen/ - the "compile extension" codegen library
    codegen_next/ - the new proc-macro library
  examples/ - unchanged
  scripts/ - unchanged
  site/ - unchanged

This commit also removes the following files:

  appveyor.yml - AppVeyor (Rust on Windows) is far too spotty for use
  rustfmt.toml - rustfmt is, unfortunately, not mature enough for use

Finally, all example Cargo crates were marked with 'publish = false'.
2018-06-03 18:44:38 +02:00

112 lines
2.0 KiB
Rust

#![feature(plugin, decl_macro, custom_derive)]
#![plugin(rocket_codegen)]
#[derive(FromForm)]
struct MyForm {
#[form(field = "blah", field = "bloo")]
//~^ ERROR: incorrect use of attribute
my_field: String,
}
#[derive(FromForm)]
struct MyForm1 {
#[form]
//~^ ERROR: incorrect use of attribute
my_field: String,
}
#[derive(FromForm)]
struct MyForm2 {
#[form("blah")]
//~^ ERROR: invalid `form` attribute
my_field: String,
}
#[derive(FromForm)]
struct MyForm3 {
#[form(123)]
//~^ ERROR: invalid `form` attribute
my_field: String,
}
#[derive(FromForm)]
struct MyForm4 {
#[form(beep = "bop")]
//~^ ERROR: invalid `form` attribute
my_field: String,
}
#[derive(FromForm)]
struct MyForm5 {
#[form(field = "blah")]
#[form(field = "blah")]
my_field: String,
//~^ ERROR: only a single
}
#[derive(FromForm)]
struct MyForm6 {
#[form(field = true)]
//~^ ERROR: invalid `field` in attribute
my_field: String,
}
#[derive(FromForm)]
struct MyForm7 {
#[form(field)]
//~^ ERROR: invalid `field` in attribute
my_field: String,
}
#[derive(FromForm)]
struct MyForm8 {
#[form(field = 123)]
//~^ ERROR: invalid `field` in attribute
my_field: String,
}
#[derive(FromForm)]
struct MyForm9 {
#[form(field = "hello")]
first: String,
#[form(field = "hello")]
//~^ ERROR: field with duplicate name
other: String,
}
#[derive(FromForm)]
struct MyForm10 {
first: String,
#[form(field = "first")]
//~^ ERROR: field with duplicate name
other: String,
}
#[derive(FromForm)]
struct MyForm11 {
#[form(field = "hello&world")]
//~^ ERROR: invalid form field
first: String,
}
#[derive(FromForm)]
struct MyForm12 {
#[form(field = "!@#$%^&*()_")]
//~^ ERROR: invalid form field
first: String,
}
#[derive(FromForm)]
struct MyForm13 {
#[form(field = "?")]
//~^ ERROR: invalid form field
first: String,
}
#[derive(FromForm)]
struct MyForm14 {
#[form(field = "")]
//~^ ERROR: invalid form field
first: String,
}