-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.code-snippets
More file actions
54 lines (54 loc) · 1.54 KB
/
test.code-snippets
File metadata and controls
54 lines (54 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{
"Test a model": {
"scope": "rust",
"prefix": "model_test",
"body": [
"#[cfg(test)]",
"mod test_${1/(.*)/${1:/downcase}/} {",
" use rstest::rstest;",
" use serde_json::from_str;",
"",
" use super::${1:model};",
" use crate::{",
" worldstate::{",
" fixtures::${1/(.*)/${1:/downcase}/}::{",
" ${1/(.*)/${1:/downcase}/},",
" ${1/(.*)/${1:/downcase}/}_en,",
" },",
" models::Queryable,",
" },",
" };",
"",
" type R = <${1:model} as Queryable>::Return;",
"",
" #[rstest]",
" fn test(${1/(.*)/${1:/downcase}/}_en: &str) {",
" from_str::<R>(${1/(.*)/${1:/downcase}/}_en).unwrap();",
" }",
"",
" #[rstest]",
" fn test_ml(${1/(.*)/${1:/downcase}/}: &str) {",
" from_str::<R>(${1/(.*)/${1:/downcase}/}).unwrap();",
" }",
"}",
]
},
"Fixture": {
"scope": "rust",
"prefix": "fixture",
"body": [
"use crate::fixture;",
"",
"fixture! {",
" $1,",
"r#\"",
"$2",
"\"#",
"---",
"r#\"",
"$3",
"\"#",
"}",
]
}
}