test: Improve `template_not_found` test to detect stable/nightly mismatch error
cc #50
This commit is contained in:
parent
10ab29be85
commit
2cc9556dbe
|
@ -1,6 +1,10 @@
|
||||||
use sailfish::TemplateOnce;
|
use sailfish::TemplateOnce;
|
||||||
use sailfish_macros::TemplateOnce;
|
use sailfish_macros::TemplateOnce;
|
||||||
|
|
||||||
|
#[derive(TemplateOnce)]
|
||||||
|
#[template(path = "empty.stpl")]
|
||||||
|
struct ExistTemplate;
|
||||||
|
|
||||||
#[derive(TemplateOnce)]
|
#[derive(TemplateOnce)]
|
||||||
#[template(path = "not_exist.stpl")]
|
#[template(path = "not_exist.stpl")]
|
||||||
struct NotExistTemplate {
|
struct NotExistTemplate {
|
||||||
|
@ -8,5 +12,6 @@ struct NotExistTemplate {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
println!("{}", ExistTemplate.render_once().unwrap());
|
||||||
println!("{}", NotExistTemplate { var: 1996 }.render_once().unwrap());
|
println!("{}", NotExistTemplate { var: 1996 }.render_once().unwrap());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +1,18 @@
|
||||||
error: Template file "not_exist.stpl" not found
|
error: Template file "not_exist.stpl" not found
|
||||||
--> $DIR/template_not_found.rs:5:19
|
--> $DIR/template_not_found.rs:9:19
|
||||||
|
|
|
|
||||||
5 | #[template(path = "not_exist.stpl")]
|
9 | #[template(path = "not_exist.stpl")]
|
||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0599]: no method named `render_once` found for struct `NotExistTemplate` in the current scope
|
error[E0599]: no method named `render_once` found for struct `NotExistTemplate` in the current scope
|
||||||
--> $DIR/template_not_found.rs:11:51
|
--> $DIR/template_not_found.rs:16:51
|
||||||
|
|
|
|
||||||
6 | struct NotExistTemplate {
|
10 | struct NotExistTemplate {
|
||||||
| ----------------------- method `render_once` not found for this
|
| ----------------------- method `render_once` not found for this
|
||||||
...
|
...
|
||||||
11 | println!("{}", NotExistTemplate { var: 1996 }.render_once().unwrap());
|
16 | println!("{}", NotExistTemplate { var: 1996 }.render_once().unwrap());
|
||||||
| ^^^^^^^^^^^ method not found in `NotExistTemplate`
|
| ^^^^^^^^^^^ method not found in `NotExistTemplate`
|
||||||
|
|
|
|
||||||
= help: items from traits can only be used if the trait is implemented and in scope
|
= help: items from traits can only be used if the trait is implemented and in scope
|
||||||
= note: the following trait defines an item `render_once`, perhaps you need to implement it:
|
= note: the following trait defines an item `render_once`, perhaps you need to implement it:
|
||||||
candidate #1: `TemplateOnce`
|
candidate #1: `TemplateOnce`
|
||||||
|
|
||||||
warning: unused import: `sailfish::TemplateOnce`
|
|
||||||
--> $DIR/template_not_found.rs:1:5
|
|
||||||
|
|
|
||||||
1 | use sailfish::TemplateOnce;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `#[warn(unused_imports)]` on by default
|
|
||||||
|
|
Loading…
Reference in New Issue