1
mod api;
2
mod cite;
3
mod gallery;
4
mod image;
5
mod indicator;
6
mod parsoid;
7
pub(crate) mod test_client;
8

            
9
use super::*;
10

            
11
#[test]
12
2
fn test_clean_link() {
13
2
    assert_eq!(
14
2
        clean_link("./Template:Foo_bar"),
15
2
        "Template:Foo bar".to_string()
16
2
    );
17
2
    assert_eq!(clean_link("ifeq"), "ifeq".to_string());
18
2
}
19

            
20
#[test]
21
2
fn test_full_link() {
22
2
    assert_eq!(
23
2
        full_link("Template:Foo bar"),
24
2
        "./Template:Foo_bar".to_string()
25
2
    );
26
    // Yes, this is not what you'd expect. It's not a direct reversal of clean_link()
27
2
    assert_eq!(full_link("ifeq"), "./ifeq".to_string());
28
2
}
29

            
30
#[test]
31
2
fn test_attribute_contains_word() {
32
2
    assert!(attribute_contains_word("mw:Foo", "mw:Foo")); // yes
33
2
    assert!(!attribute_contains_word("mw:Foo", "mw:Bar")); // no
34
2
    assert!(attribute_contains_word("mw:Foo mw:Bar", "mw:Bar")); // yes
35
2
    assert!(!attribute_contains_word("mw:Foo/Bar", "mw:Foo")); // no
36
2
}