File: basic.rs

package info (click to toggle)
rust-diesel-table-macro-syntax 0.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 100 kB
  • sloc: makefile: 4
file content (18 lines) | stat: -rw-r--r-- 473 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use diesel_table_macro_syntax::*;

#[test]
fn basic() {
    let input = include_str!("basic.rs.in");
    let t: TableDecl = syn::parse_str(input).unwrap();
    assert_eq!(t.column_defs.len(), 3);
    assert_eq!(
        t.column_defs
            .iter()
            .map(|c| c
                .max_length
                .as_ref()
                .map(|n| n.base10_parse::<usize>().unwrap()))
            .collect::<Vec<_>>(),
        &[None, Some(120), Some(120)]
    )
}