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
pub mod gqlidl;
pub mod ast;
extern crate regex;
#[test]
fn scalar_no_description() {
let defs = gqlidl::parse_schema("scalar DateTime").unwrap().pop().unwrap();
assert_eq!("scalar", defs.gql_type.as_str());
assert_eq!("DateTime", defs.name);
}
#[test]
fn scalar_with_description() {
let defs = gqlidl::parse_schema("# An ISO-8601 encoded UTC date string.\nscalar DateTime").unwrap().pop().unwrap();
assert_eq!("An ISO-8601 encoded UTC date string.", defs.description);
assert_eq!("scalar", defs.gql_type.as_str());
assert_eq!("DateTime", defs.name);
}
#[test]
fn type_no_description() {
let defs = gqlidl::parse_schema("type CodeOfConduct").unwrap().pop().unwrap();
assert_eq!("object", defs.gql_type.as_str());
assert_eq!("CodeOfConduct", defs.name);
}