use neutralts::constants::*;

// requires "preserve_order": serde_json = { version = "1.0", features = ["preserve_order"] }

// Here you can add things but you cannot modify or remove them.
const SCHEMA: &str = r#"{
    "config": {
        "infinite_loop_max_bifs": 555000,
        "comments": "remove",
        "errors": "hide"
    },
    "inherit": {
        "snippets": {
            "__hello-nts": "<div>{:trans; ref:greeting-nts :}</div>"
        },
        "declare": {
            "any": "*",
            "traversal": "/* \\\\* *\\.\\.*",
            "_test-nts": "en es fr de nts",
            "_test-nts-empty": "~ nts en es fr de",
            "_test-nts-asterisk": "*en* nts es fr de",
            "_test-nts-question": "en?nts nts es fr de",
            "_test-nts-dot": "en.nts es fr de"
        },
        "params": {},
        "locale": {
            "current": "en",
            "trans": {
                "en": {
                    "Hello nts": "Hello",
                    "ref:greeting-nts": "Hello"
                },
                "en-US": {
                    "Hello nts": "Hello",
                    "ref:greeting-nts": "Hello"
                },
                "en-UK": {
                    "Hello nts": "Hello",
                    "ref:greeting-nts": "Hello"
                },
                "es": {
                    "Hello nts": "Hola",
                    "ref:greeting-nts": "Hola"
                },
                "es-ES": {
                    "Hello nts": "Hola",
                    "ref:greeting-nts": "Hola"
                },
                "de": {
                    "Hello nts": "Hallo",
                    "ref:greeting-nts": "Hallo"
                },
                "fr": {
                    "Hello nts": "Bonjour",
                    "ref:greeting-nts": "Bonjour"
                },
                "el": {
                    "Hello nts": "Γεια σας",
                    "ref:greeting-nts": "Γεια σας"
                }
            }
        }
    },
    "data": {
        "CONTEXT": {
            "GET": {
                "escape": "<>&\"'/{}"
            }
        },
        "__hello-nts": "Hello nts",
        "__ref-hello-nts": "__hello-nts",
        "__test-local": "local",
        "__test-nts": "nts",
        "__test-empty-nts": "",
        "__test-null-nts": null,
        "__test-zero-nts": 0,
        "__test-bool-true-string-nts": true,
        "__test-bool-true-num-nts": 1,
        "__test-bool-false-string-nts": false,
        "__test-bool-false-num-nts": 0,
        "__test-bool-false-empty-nts": "",
        "__test-arr-nts": [
            "one",
            "two",
            "three"
        ],
        "__test-arr-empty-nts": [],
        "__test-obj-empty-nts": {},
        "__test-obj-nts": {
            "level1": "Ok",
            "level1-obj": {
                "level1": "Ok",
                "level2-obj": {
                    "level2": "Ok",
                    "level3-arr": [
                        "one",
                        "two",
                        "three"
                    ]
                }
            }
        },
        "escape": "<>&\"'/{}",
        "double_escape": "&lt;&gt;&amp;&quot;&#x27;&#x2F;&#123;&#125;",
        "true": true,
        "false": false,
        "text": "text",
        "zero": "0",
        "one": "1",
        "spaces": "  ",
        "empty": "",
        "null": null,
        "emptyarr": [],
        "array": {
            "true": true,
            "false": false,
            "text": "text",
            "zero": "0",
            "one": "1",
            "spaces": "  ",
            "empty": "",
            "null": null
        }
    }
}"#;

// SOME BIF DEPENDS ON OTHERS, IF IT FAILS CHECK THESE DEPENDENCIES.

#[test]
fn test_bif_neutral() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:neutral; template >> system :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>{:neutral; template >> system :}</div>");
}

#[test]
fn test_bif_unknown() {
    let schema = r#"
    {
        "config": {
            "comments": "keep"
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:unk;:}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_comments() {
    let schema = r#"
    {
        "config": {
            "comments": "keep"
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:* comment *:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_comments_multiline() {
    let schema = r#"
    {
        "config": {
            "comments": "keep"
        }
    }
    "#
    .trim();
    let source = r#"
        {:*

            test comment

        *:}
        <div></div>
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str(source);
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_comments_nested() {
    let schema = r#"
    {
        "config": {
            "comments": "keep"
        }
    }
    "#
    .trim();
    let source = r#"
        {:*
            test comment
            {:* comment *:}
        *:}
        <div></div>
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str(source);
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_comments_complex() {
    let schema = r#"
    {
        "config": {
            "comments": "keep"
        }
    }
    "#
    .trim();
    let source = r#"
        {:* comment *:}
        {:* {:code; *:}
            {:code;
                {:* comment *:}
                <div>{:; {:* comment *:} __test-nts {:* comment *:} :}</div>
            :}
        {:* :} *:}
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str(source);
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_comments_remove() {
    let schema = r#"
    {
        "config": {
            "comments": "remove"
        }
    }
    "#
    .trim();
    let source = r#"
        {:* comment *:}
        {:* {:code; *:}
            {:code;
                {:* comment *:}
                <div>{:; {:* comment *:} __test-nts {:* comment *:} :}</div>
            :}
        {:* :} *:}
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str(source);
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_unprintable() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_unprintable_spaces() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div> {:;:} </div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>  </div>");
}

#[test]
fn test_bif_unprintable_upline() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("|  \n  {:^;:}<div></div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "|<div></div>");
}

#[test]
fn test_bif_unprintable_comments() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("{:; {:* comment *:} :}<div></div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_var() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_var_arr() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-obj-nts->level1-obj->level2-obj->level3-arr->0:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>one</div>");
}

#[test]
fn test_bif_var_dynamic_evaluation() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__hello-{:;__test-nts:}:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Hello nts</div>");
}

#[test]
fn test_bif_var_error_dynamic_evaluation() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;{:;__ref-hello-nts:}:}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_var_undefined() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__dfhs76tfwq65dhtw563hjknv__:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_var_upline() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("|  \n  {:^;__test-nts:}<div></div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "|nts<div></div>");
}

#[test]
fn test_bif_var_filter() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:&;escape:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>&lt;&gt;&amp;&quot;&#x27;&#x2F;&#123;&#125;</div>");
}

#[test]
fn test_bif_var_filter_double() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:&;double_escape:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>&lt;&gt;&amp;&quot;&#x27;&#x2F;&#123;&#125;</div>");
}

#[test]
fn test_bif_var_filter_context() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;CONTEXT->GET->escape:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>&lt;&gt;&amp;&quot;&#x27;&#x2F;&#123;&#125;</div>");
}
#[test]
fn test_bif_var_filter_context_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!;CONTEXT->GET->escape:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><>&\"'/{}</div>");
}

#[test]
fn test_bif_var_filter_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:&!;escape:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><>&\"'/{}</div>");
}

#[test]
fn test_bif_var_filter_all() {
    let schema = r#"
    {
        "config": {
            "filter_all": true
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:;escape:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>&lt;&gt;&amp;&quot;&#x27;&#x2F;&#123;&#125;</div>");
}

#[test]
fn test_bif_var_filter_all_negate() {
    let schema = r#"
    {
        "config": {
            "filter_all": true
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:!;escape:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><>&\"'/{}</div>");
}

#[test]
fn test_bif_var_error_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:+;__test-nts:}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_trans() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "el"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:trans; Hello nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Γεια σας</div>");
}

#[test]
fn test_bif_trans_dynamic_evaluation() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "el"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:trans; {:;__hello-nts:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Γεια σας</div>");
}

#[test]
fn test_bif_trans_no_trans() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "el"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:trans; This text has no __translation__ :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>This text has no __translation__</div>");
}

#[test]
fn test_bif_trans_no_trans_negate() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "el"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:!trans; This text has no __translation__ :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_trans_negate() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "el"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:!trans; Hello nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Γεια σας</div>");
}

#[test]
fn test_bif_trans_error_scope() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "el"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:+trans; Hello nts :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_lang() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "el"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:lang;:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>el</div>");
}

#[test]
fn test_bif_lang_comment() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "el"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:lang; {:* comment *:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>el</div>");
}

#[test]
fn test_bif_lang_error_negate() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "el"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:!lang;:}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_lang_error_scope() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "el"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:+lang;:}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_code_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_code_literal() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; Hello :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Hello</div>");
}

#[test]
fn test_bif_code_evaluation() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_code_flag_safe() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; {:flg; safe :} >> <div>{:;__test-nts:}</div> :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(
        result,
        "<div>&lt;div&gt;&#123;:;__test-nts:&#125;&lt;&#x2F;div&gt;</div>"
    );
}

#[test]
fn test_bif_code_flag_encode_tags() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template
        .set_src_str("<div>{:code; {:flg; encode_tags :} >> <div>{:;__test-nts:}</div> :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>&lt;div&gt;nts&lt;&#x2F;div&gt;</div>");
}

#[test]
fn test_bif_code_flag_noparse() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; {:flg; noparse :} >> <div>{:;__test-nts:}</div> :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>{:;__test-nts:}</div></div>");
}

#[test]
fn test_bif_code_flag_encode_tags_after() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; {:flg; encode_tags_after :} >> <div>{:code; <div>{:;__test-nts:}</div> :}</div> :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(
        result,
        "<div>&lt;div&gt;&lt;div&gt;nts&lt;&#x2F;div&gt;&lt;&#x2F;div&gt;</div>"
    );
}

#[test]
fn test_bif_code_no_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; {:include; {:flg; require :} >> tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_code_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:+code; {:include; {:flg; require :} >> tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet</div></div>");
}

#[test]
fn test_bif_param() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; {:param; 1 >> one :} {:param; 1 :} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>one</div>");
}

#[test]
fn test_bif_param_set_outside_code() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:param; 1 >> one :}{:param; 1 :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_param_evaluation() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; {:param; {:;__test-nts:} >> {:;__test-nts:} :} {:param; {:;__test-nts:} :} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_param_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; {:param; 1 >> one :} {:code; {:param; 1 :} :} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>one</div>");
}

#[test]
fn test_bif_param_no_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; {:param; {:;__test-nts:} >> {:;__test-nts:} :} :}{:param; {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_allow() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; _test-nts >> en :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>en</div>");
}

#[test]
fn test_bif_allow_evaluate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; _test-{:;__test-nts:} >> {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_allow_fails() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; _test-nts >> notallow :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_allow_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!allow; traversal >> is not traversal :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not traversal</div>");
}

#[test]
fn test_bif_allow_negate_fails() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!allow; traversal >> ../istraversal :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_allow_any() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; any >> something :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>something</div>");
}

#[test]
fn test_bif_allow_wildcard_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; _test-nts-empty >>  :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_allow_wildcard_asterisk() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; _test-nts-asterisk >> en-nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>en-nts</div>");
}

#[test]
fn test_bif_allow_wildcard_asterisk_fails() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; _test-nts-asterisk >> not :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_allow_wildcard_dot_1() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; _test-nts-dot >> ennts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>ennts</div>");
}

#[test]
fn test_bif_allow_wildcard_dot_2() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; _test-nts-dot >> en-nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>en-nts</div>");
}

#[test]
fn test_bif_allow_wildcard_dot_fails() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; _test-nts-dot >> not :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_allow_wildcard_question() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; _test-nts-question >> en-nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>en-nts</div>");
}

#[test]
fn test_bif_allow_wildcard_question_fails() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; _test-nts-question >> ennts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_allow_no_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:+allow; _test-nts >> notallow :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_allow_flag_partial() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow;{:flg; partial :} _test-nts >> nts and more :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts and more</div>");
}

#[test]
fn test_bif_allow_flag_casein() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow;{:flg; casein :} _test-nts >> NTS :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>NTS</div>");
}

#[test]
fn test_bif_allow_flag_replace() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow;{:flg; replace :} _test-nts >> nts and more :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_allow_flag_noerror() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow;{:flg; noerror :} _test-nts >> nts and more :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_allow_multi_flags() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:allow; {:flg; casein replace :} _test-nts >> NTS :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_declare() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(
        "<div>{:include; tests/snippets.ntpl :}{:allow; test-for-tests >> one :}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>one</div>");
}

#[test]
fn test_bif_declare_no_outside_include() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:declare; test-for-tests >> one two three :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_for() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:for; n 0 9 >> {:;n:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>0123456789</div>");
}

#[test]
fn test_bif_for_rev() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:for; n 9 0 >> {:;n:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>9876543210</div>");
}

#[test]
fn test_bif_for_params_fails_1() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:for; n a b >> {:;n:} :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_for_params_fails_2() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:for; n a >> {:;n:} :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_for_params_fails_3() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:for; n >> {:;n:} :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_for_params_fails_4() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:for; >> {:;n:} :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_for_no_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!for; n 0 9 >> {:;n:} :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_for_no_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:+for; n 0 9 >> {:;n:} :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_else() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; :}{:else; nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_else_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; 1 :}{:!else; nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>1nts</div>");
}

#[test]
fn test_bif_else_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; :}{:+else; __test-obj-nts >> {:include; tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet</div></div>");
}

#[test]
fn test_bif_else_no_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:code; :}{:else; __test-obj-nts >> {:include; tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_snippet() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; tests/snippets.ntpl :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet</div></div>");
}

#[test]
fn test_bif_snip() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; tests/snippets.ntpl :}{:snip; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet</div></div>");
}

#[test]
fn test_bif_snippet_evalueation() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(
        "<div>{:include; tests/snippets.ntpl :}{:snippet; test-snippet-{:;__test-nts:} :}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet nts</div></div>");
}

#[test]
fn test_bif_snip_evalueation() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(
        "<div>{:include; tests/snippets.ntpl :}{:snip; test-snippet-{:;__test-nts:} :}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet nts</div></div>");
}

#[test]
fn test_bif_snippet_nested() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; tests/snippets.ntpl :}{:snippet; test-snippet-nested :}{:snippet; test-snippet-nested-next :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet nested</div></div>");
}

#[test]
fn test_bif_snip_nested() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; tests/snippets.ntpl :}{:snip; test-snippet-nested :}{:snip; test-snippet-nested-next :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet nested</div></div>");
}

#[test]
fn test_bif_snippet_nested_set_in_code() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template
        .set_src_str("<div>{:include; tests/snippets.ntpl :}{:snippet; test-snippet-code :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet code</div></div>");
}

#[test]
fn test_bif_snippet_no_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(
        "<div>{:* error, unnecessary scope, it is auto *:}{:+snippet; test-snippet :}</div>",
    );
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_snippet_no_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; tests/snippets.ntpl :}{:!snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_include() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; tests/include-snippets.ntpl :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Ok</div>");
}

#[test]
fn test_bif_include_flag_require() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template
        .set_src_str("<div>{:include; {:flg; require :} >> tests/include-snippets.ntpl :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Ok</div>");
}

#[test]
fn test_bif_include_flag_require_fails() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; {:flg; require :} >> tests/not-found.ntpl :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_include_not_found() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; tests/not-found.ntpl :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_include_allow() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; {:allow; any >> {:;__test-nts:} :} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_include_allow_fails() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_include_without_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; tests/include-snippets.ntpl :}{:include; tests/include-snippets.ntpl :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>OkOk</div>");
}

#[test]
fn test_bif_include_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; tests/include-snippets.ntpl :}{:!include; tests/include-snippets.ntpl :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Ok</div>");
}

#[test]
fn test_bif_include_text_files() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; {:flg; safe :} >> tests/include.txt :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(
        result,
        "<div>Lorem Ipsum &lt;div&gt;&#123;:code; :&#125;&lt;&#x2F;div&gt;</div>"
    );
}

#[test]
fn test_bif_include_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:* error, unnecessary scope, it is auto *:}{:+include; tests/include-snippets.ntpl :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_eval() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:eval; a >> b :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>b</div>");
}

#[test]
fn test_bif_eval_evaluation() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:eval; {:;__test-nts:} >> {:;__eval__:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_eval_negate_1() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!eval; {:;__test-nts:} >> nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_eval_negate_2() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!eval; {:;__test-empty-nts:} >> nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_eval_scope_1() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(
        "<div>{:eval; {:include; tests/snippets.ntpl :} >> nts :}{:snippet; test-snippet :}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_eval_scope_2() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(
        "<div>{:+eval; {:include; tests/snippets.ntpl :} >> nts :}{:snippet; test-snippet :}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet</div></div>");
}

#[test]
fn test_bif_eval_scope_3() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(
        "<div>{:+eval; 1 >> {:include; tests/snippets.ntpl :}  :}{:snippet; test-snippet :}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet</div></div>");
}

#[test]
fn test_bif_eval_scope_4() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:+eval; {:include; tests/snippets.ntpl :} >> {:include; tests/snippets.ntpl :}  :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet</div></div>");
}

#[test]
fn test_bif_locale() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "es"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:locale; tests/locale.es.json :}{:trans; test-locale :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Ok</div>");
}

#[test]
fn test_bif_locale_evaluation() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "es"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str(
        "<div>{:locale; tests/locale.{:lang;:}.json :}{:trans; Test {:;__test-nts:} :}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Ok nts</div>");
}

#[test]
fn test_bif_locale_flag_inline() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "es"
            }
        }
    }
    "#
    .trim();
    let source = r#"
        {:locale; {:flg; inline :} >>
            {
                "trans": {
                    "{:lang;:}": {
                        "test-locale": "inline"
                    }
                }
            }
        :}
        <div>{:trans; test-locale :}</div>
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str(source);
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>inline</div>");
}

#[test]
fn test_bif_locale_flag_require() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "es"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str(
        "<div>{:locale; {:flg; require :} >> tests/locale.es.json :}{:trans; test-locale :}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Ok</div>");
}

#[test]
fn test_bif_locale_flag_require_fails() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "es"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:locale; {:flg; require :} >> tests/not-found.es.json :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_locale_not_found() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "es"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:locale; tests/not-found.es.json :}{:trans; test-locale :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>test-locale</div>");
}

#[test]
fn test_bif_locale_allow() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "es"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:locale; {:allow; any >> {:;__test-nts:} :} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_locale_allow_fails() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "es"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:locale; {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_locale_negate() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "es"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:!locale; tests/locale.es.json :}{:!locale; tests/locale.es.json :}{:trans; test-locale :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Ok</div>");
}

#[test]
fn test_bif_locale_scope() {
    let schema = r#"
    {
        "inherit": {
            "locale": {
                "current": "es"
            }
        }
    }
    "#
    .trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("<div>{:+locale; tests/locale.es.json :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_flg() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:flg; any :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_each() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:each; __test-obj-nts->level1-obj->level2-obj->level3-arr key value >> {:;key:}={:;value:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>0=one1=two2=three</div>");
}

#[test]
fn test_bif_each_iterate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; tests/snippets.ntpl :}{:code; {:param; array-name >> __test-obj-nts :} {:snippet; iterate-array :} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(
        result,
        "<div>\n        level1=Ok\n        level1-obj:\n                level1=Ok\n                level2-obj:\n                        level2=Ok\n                        level3-arr:\n                                0=one\n                                1=two\n                                2=three</div>"
    );
}

#[test]
fn test_bif_coalesce() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:coalesce; {:code; :} {:code; this :} {:code; ... :} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>this</div>");
}

#[test]
fn test_bif_coalesce_evaluation() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:coalesce; {:;__test-empty-nts:} {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_coalesce_nested() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:coalesce; {:code; :} {:coalesce; {:code; :} {:coalesce; {:code; :} {:code; this :} {:code; ... :} :} {:code; ... :} :} {:code; ... :} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>this</div>");
}

#[test]
fn test_bif_coalesce_negate_fails() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!coalesce; {:code; :} {:code; this :} {:code; ... :} :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_coalesce_big() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:include; tests/snippets.ntpl :}{:snippet; big-coalesce :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>OK1-Ok2-Ok3-Ok4-Ok5-Ok6</div>");
}

#[test]
fn test_bif_coalesce_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(
        "<div>{:+coalesce; {:include; tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet</div></div>");
}

#[test]
fn test_bif_coalesce_no_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(
        "<div>{:coalesce; {:include; tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_replace() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:replace; /a/b/ >> acbde :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>bcbde</div>");
}

#[test]
fn test_bif_replace_evaluation() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(
        "<div>{:replace; /{:;__test-nts:}/{:;__test-arr-nts->0:}/ >> {:;__hello-nts:} :}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Hello one</div>");
}

#[test]
fn test_bif_replace_delim_1() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:replace; |a|b| >> acbde :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>bcbde</div>");
}

#[test]
fn test_bif_replace_delim_2() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:replace; ~a~b~ >> acbde :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>bcbde</div>");
}

#[test]
fn test_bif_replace_delim_3() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:replace; :a:b: >> acbde :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>bcbde</div>");
}

#[test]
fn test_bif_replace_params_fails() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:replace; a/b >> acbde :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_moveto_head() {
    let source = r#"
        <!DOCTYPE html>
        <html lang="es">
            <head>
                <meta charset="UTF-8">
                <title>Lorem Ipsum</title>
                <style></style>
            </head>
            <body>
                <div class="container">
                    <h1>Lorem ipsum</h1>
                    <p>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vehicula turpis nec
                        libero volutpat, at tincidunt dui cursus. Maecenas euismod, diam nec fringilla malesuada,
                        justo tellus gravida sapien, nec sollicitudin nulla odio a lorem.
                    </p>
                </div>
            </body>
        </html>
        {:moveto; <head >> <script></script> :}
    "#.trim();
    let out = r#"
        <!DOCTYPE html>
        <html lang="es">
            <head><script></script>
                <meta charset="UTF-8">
                <title>Lorem Ipsum</title>
                <style></style>
            </head>
            <body>
                <div class="container">
                    <h1>Lorem ipsum</h1>
                    <p>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vehicula turpis nec
                        libero volutpat, at tincidunt dui cursus. Maecenas euismod, diam nec fringilla malesuada,
                        justo tellus gravida sapien, nec sollicitudin nulla odio a lorem.
                    </p>
                </div>
            </body>
        </html>
    "#.trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(source);
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, out);
}

#[test]
fn test_bif_moveto_head_once() {
    let source = r#"
        <!DOCTYPE html>
        <html lang="es">
            <head>
                <meta charset="UTF-8">
                <title>Lorem Ipsum</title>
                <style></style>
            </head>
            <body>
                <div class="container">
                    <h1>Lorem ipsum</h1>
                    <p>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vehicula turpis nec
                        libero volutpat, at tincidunt dui cursus. Maecenas euismod, diam nec fringilla malesuada,
                        justo tellus gravida sapien, nec sollicitudin nulla odio a lorem.
                    </p>
                </div>
            </body>
        </html>
        {:moveto; <head >> <script></script> :}
        {:moveto; <head >> <script></script> :}
        {:moveto; <head >> <script></script> :}
    "#.trim();
    let out = r#"
        <!DOCTYPE html>
        <html lang="es">
            <head><script></script>
                <meta charset="UTF-8">
                <title>Lorem Ipsum</title>
                <style></style>
            </head>
            <body>
                <div class="container">
                    <h1>Lorem ipsum</h1>
                    <p>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vehicula turpis nec
                        libero volutpat, at tincidunt dui cursus. Maecenas euismod, diam nec fringilla malesuada,
                        justo tellus gravida sapien, nec sollicitudin nulla odio a lorem.
                    </p>
                </div>
            </body>
        </html>
    "#.trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(source);
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, out);
}

#[test]
fn test_bif_moveto_head_ends() {
    let source = r#"
        <!DOCTYPE html>
        <html lang="es">
            <head>
                <meta charset="UTF-8">
                <title>Lorem Ipsum</title>
                <style></style>
            </head>
            <body>
                <div class="container">
                    <h1>Lorem ipsum</h1>
                    <p>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vehicula turpis nec
                        libero volutpat, at tincidunt dui cursus. Maecenas euismod, diam nec fringilla malesuada,
                        justo tellus gravida sapien, nec sollicitudin nulla odio a lorem.
                    </p>
                </div>
            </body>
        </html>
        {:moveto; </head >> <script></script> :}
    "#.trim();
    let out = r#"
        <!DOCTYPE html>
        <html lang="es">
            <head>
                <meta charset="UTF-8">
                <title>Lorem Ipsum</title>
                <style></style>
            <script></script></head>
            <body>
                <div class="container">
                    <h1>Lorem ipsum</h1>
                    <p>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vehicula turpis nec
                        libero volutpat, at tincidunt dui cursus. Maecenas euismod, diam nec fringilla malesuada,
                        justo tellus gravida sapien, nec sollicitudin nulla odio a lorem.
                    </p>
                </div>
            </body>
        </html>
    "#.trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(source);
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, out);
}

#[test]
fn test_bif_moveto_body_ends() {
    let source = r#"
        <!DOCTYPE html>
        <html lang="es">
            <head>
                <meta charset="UTF-8">
                <title>Lorem Ipsum</title>
                <style></style>
            </head>
            <body>
                <div class="container">
                    <h1>Lorem ipsum</h1>
                    <p>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vehicula turpis nec
                        libero volutpat, at tincidunt dui cursus. Maecenas euismod, diam nec fringilla malesuada,
                        justo tellus gravida sapien, nec sollicitudin nulla odio a lorem.
                    </p>
                </div>
            </body>
        </html>
        {:moveto; </body >> <script></script> :}
    "#.trim();
    let out = r#"
        <!DOCTYPE html>
        <html lang="es">
            <head>
                <meta charset="UTF-8">
                <title>Lorem Ipsum</title>
                <style></style>
            </head>
            <body>
                <div class="container">
                    <h1>Lorem ipsum</h1>
                    <p>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vehicula turpis nec
                        libero volutpat, at tincidunt dui cursus. Maecenas euismod, diam nec fringilla malesuada,
                        justo tellus gravida sapien, nec sollicitudin nulla odio a lorem.
                    </p>
                </div>
            <script></script></body>
        </html>
    "#.trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(source);
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, out);
}

#[test]
fn test_bif_moveto_body() {
    let source = r#"
        <!DOCTYPE html>
        <html lang="es">
            <head>
                <meta charset="UTF-8">
                <title>Lorem Ipsum</title>
                <style></style>
            </head>
            <body>
                <div class="container">
                    <h1>Lorem ipsum</h1>
                    <p>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vehicula turpis nec
                        libero volutpat, at tincidunt dui cursus. Maecenas euismod, diam nec fringilla malesuada,
                        justo tellus gravida sapien, nec sollicitudin nulla odio a lorem.
                    </p>
                </div>
            </body>
        </html>
        {:moveto; <body >> <script></script> :}
    "#.trim();
    let out = r#"
        <!DOCTYPE html>
        <html lang="es">
            <head>
                <meta charset="UTF-8">
                <title>Lorem Ipsum</title>
                <style></style>
            </head>
            <body><script></script>
                <div class="container">
                    <h1>Lorem ipsum</h1>
                    <p>
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam vehicula turpis nec
                        libero volutpat, at tincidunt dui cursus. Maecenas euismod, diam nec fringilla malesuada,
                        justo tellus gravida sapien, nec sollicitudin nulla odio a lorem.
                    </p>
                </div>
            </body>
        </html>
    "#.trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(source);
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, out);
}

#[test]
fn test_bif_date_timestamp() {
    use std::time::SystemTime;
    fn is_timestamp(value: u64) -> bool {
        SystemTime::UNIX_EPOCH
            .checked_add(std::time::Duration::from_secs(value))
            .is_some()
    }
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("{:date; :}");
    let result = template.render().parse::<u64>().unwrap();

    assert!(!template.has_error());
    assert!(is_timestamp(result));
}

#[test]
fn test_bif_date() {
    use chrono::{DateTime, Utc};
    use std::str::FromStr;
    pub fn is_valid_rfc3339(value: &str) -> bool {
        DateTime::<Utc>::from_str(value).is_ok()
    }
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("{:date; %Y-%m-%d %H:%M:%S :}");
    let result = template.render();
    assert!(!template.has_error());
    assert!(!is_valid_rfc3339(&result));
}

#[test]
fn test_bif_rand() {
    pub fn number(s: &str, x: usize) -> bool {
        s.chars()
            .filter(|c| c.is_numeric())
            .collect::<String>()
            .len()
            == x
    }

    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("{:rand; :}");
    let result = template.render();
    assert!(!template.has_error());
    assert!(number(&result, 9));
}

#[test]
fn test_bif_rand_10_99() {
    pub fn number(s: &str, x: usize) -> bool {
        s.chars()
            .filter(|c| c.is_numeric())
            .collect::<String>()
            .len()
            == x
    }

    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("{:rand; 10..99 :}");
    let result = template.render();
    assert!(!template.has_error());
    assert!(number(&result, 2));
}

#[test]
fn test_bif_hash() {
    fn is_md5_like(s: &str) -> bool {
        s.len() == 32 && s.chars().all(|c| c.is_ascii_hexdigit())
    }

    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("{:hash; :}");
    let result = template.render();
    assert!(!template.has_error());
    assert!(is_md5_like(&result));
}

#[test]
fn test_bif_hash_evaluate() {
    fn is_md5_like(s: &str) -> bool {
        s.len() == 32 && s.chars().all(|c| c.is_ascii_hexdigit())
    }

    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("{:hash; {:;__hello-nts:} :}");
    let result = template.render();
    assert!(!template.has_error());
    assert!(is_md5_like(&result));
}

#[test]
fn test_bif_hash_evaluate_2() {
    use md5::{Digest, Md5};

    pub fn calculate_md5(s: &str) -> String {
        let mut hasher = Md5::new();
        hasher.update(s);
        format!("{:x}", hasher.finalize())
    }
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("{:hash; {:;__test-nts:} :}");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(calculate_md5("nts"), result);
}

#[test]
fn test_bif_data() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:;local::hello:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>local hello</div>");
}

#[test]
fn test_bif_data_no_evaluation() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(
        "<div>{:data; tests/{:;__test-local:}-data.json :}{:;local::hello-nts:}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>{:;__test-nts:}</div>");
}

#[test]
fn test_bif_data_flag_require() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str(
        "<div>{:data; {:flg; require :} tests/local-data.json :}{:;local::hello:}</div>",
    );
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>local hello</div>");
}

#[test]
fn test_bif_data_flag_require_fails() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; {:flg; require :} >> tests/not-found.json :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_data_allow() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; {:allow; any >> {:;__test-nts:} :} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_data_allow_fails() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_exit() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "200");
    assert_eq!(template.get_status_text(), "OK");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "<div>nts");
}

#[test]
fn test_bif_exit_custom_status() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 1600 :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "1600");
    assert_eq!(template.get_status_text(), "");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "<div>nts");
}

#[test]
fn test_bif_exit_custom_status_param() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 1600 >> some :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "1600");
    assert_eq!(template.get_status_text(), "");
    assert_eq!(template.get_status_param(), "some");
    assert_eq!(result, "<div>nts");
}

#[test]
fn test_bif_exit_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:!exit; :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "200");
    assert_eq!(template.get_status_text(), "OK");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "<div>ntsnts</div>");
}

#[test]
fn test_bif_exit_202_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:!exit; 202 :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "202");
    assert_eq!(template.get_status_text(), "Accepted");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "<div>ntsnts</div>");
}

#[test]
fn test_bif_exit_206() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 206 :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "206");
    assert_eq!(template.get_status_text(), "Partial Content");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "<div>nts");
}

#[test]
fn test_bif_exit_301() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 301 >> /home :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "301");
    assert_eq!(template.get_status_text(), "Moved Permanently");
    assert_eq!(template.get_status_param(), "/home");
    assert_eq!(result, "301 Moved Permanently\n/home");
}

#[test]
fn test_bif_exit_302() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 302 >> /home :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "302");
    assert_eq!(template.get_status_text(), "Found");
    assert_eq!(template.get_status_param(), "/home");
    assert_eq!(result, "302 Found\n/home");
}

#[test]
fn test_bif_exit_303() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 303 >> /home :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "303");
    assert_eq!(template.get_status_text(), "See Other");
    assert_eq!(template.get_status_param(), "/home");
    assert_eq!(result, "303 See Other\n/home");
}

#[test]
fn test_bif_exit_307() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 307 >> /home :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "307");
    assert_eq!(template.get_status_text(), "Temporary Redirect");
    assert_eq!(template.get_status_param(), "/home");
    assert_eq!(result, "307 Temporary Redirect\n/home");
}

#[test]
fn test_bif_exit_308() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 308 >> https://example.com/ :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "308");
    assert_eq!(template.get_status_text(), "Permanent Redirect");
    assert_eq!(template.get_status_param(), "https://example.com/");
    assert_eq!(result, "308 Permanent Redirect\nhttps://example.com/");
}

#[test]
fn test_bif_exit_401() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 401 :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "401");
    assert_eq!(template.get_status_text(), "Unauthorized");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "401 Unauthorized");
}

#[test]
fn test_bif_exit_403() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 403 :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "403");
    assert_eq!(template.get_status_text(), "Forbidden");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "403 Forbidden");
}

#[test]
fn test_bif_exit_404() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 404 :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "404");
    assert_eq!(template.get_status_text(), "Not Found");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "404 Not Found");
}

#[test]
fn test_bif_exit_500() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 500 :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "500");
    assert_eq!(template.get_status_text(), "Internal Server Error");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "500 Internal Server Error");
}

#[test]
fn test_bif_exit_503() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:exit; 503 :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "503");
    assert_eq!(template.get_status_text(), "Service Unavailable");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "503 Service Unavailable");
}

#[test]
fn test_bif_redirect_301() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:redirect; 301 >> https://example.com/ :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "301");
    assert_eq!(template.get_status_text(), "Moved Permanently");
    assert_eq!(template.get_status_param(), "https://example.com/");
    assert_eq!(result, "301 Moved Permanently\nhttps://example.com/");
}

#[test]
fn test_bif_redirect_302() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:redirect; 302 >> https://example.com/ :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "302");
    assert_eq!(template.get_status_text(), "Found");
    assert_eq!(template.get_status_param(), "https://example.com/");
    assert_eq!(result, "302 Found\nhttps://example.com/");
}

#[test]
fn test_bif_redirect_303() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:redirect; 303 >> https://example.com/ :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "303");
    assert_eq!(template.get_status_text(), "See Other");
    assert_eq!(template.get_status_param(), "https://example.com/");
    assert_eq!(result, "303 See Other\nhttps://example.com/");
}

#[test]
fn test_bif_redirect_307() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:redirect; 307 >> https://example.com/ :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "307");
    assert_eq!(template.get_status_text(), "Temporary Redirect");
    assert_eq!(template.get_status_param(), "https://example.com/");
    assert_eq!(result, "307 Temporary Redirect\nhttps://example.com/");
}

#[test]
fn test_bif_redirect_308() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:redirect; 308 >> https://example.com/ :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "308");
    assert_eq!(template.get_status_text(), "Permanent Redirect");
    assert_eq!(template.get_status_param(), "https://example.com/");
    assert_eq!(result, "308 Permanent Redirect\nhttps://example.com/");
}

#[test]
fn test_bif_redirect_js_reload_top() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:redirect; js:reload:top :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "200");
    assert_eq!(template.get_status_text(), "OK");
    assert_eq!(template.get_status_param(), "js:reload:top");
    assert_eq!(result, REDIR_JS_RELOAD_TOP);
}

#[test]
fn test_bif_redirect_js_reload_top_param() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:redirect; js:reload:top >> some :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "200");
    assert_eq!(template.get_status_text(), "OK");
    assert_eq!(template.get_status_param(), "some");
    assert_eq!(result, REDIR_JS_RELOAD_TOP);
}

#[test]
fn test_bif_redirect_js_reload_self() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:redirect; js:reload:self :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "200");
    assert_eq!(template.get_status_text(), "OK");
    assert_eq!(template.get_status_param(), "js:reload:self");
    assert_eq!(result, REDIR_JS_RELOAD_SELF);
}

#[test]
fn test_bif_redirect_js_reload_self_param() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:redirect; js:reload:self >> some :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "200");
    assert_eq!(template.get_status_text(), "OK");
    assert_eq!(template.get_status_param(), "some");
    assert_eq!(result, REDIR_JS_RELOAD_SELF);
}

#[test]
fn test_bif_redirect_negate_fails() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:!redirect; js:reload:top :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(template.get_status_code(), "200");
    assert_eq!(template.get_status_text(), "OK");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "<div>ntsnts</div>");
}

#[test]
fn test_bif_redirect_fails_no_params_1() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:!redirect; :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(template.get_status_code(), "200");
    assert_eq!(template.get_status_text(), "OK");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "<div>ntsnts</div>");
}

#[test]
fn test_bif_redirect_fails_no_params_2() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:;__test-nts:}{:!redirect; 301 >> :}{:;__test-nts:}</div>");
    let result = template.render();
    assert!(template.has_error());
    assert_eq!(template.get_status_code(), "200");
    assert_eq!(template.get_status_text(), "OK");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, "<div>ntsnts</div>");
}
#[test]
fn test_get_errors() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:for; n :}{:allow: none :}</div>");
    let result = template.render();
    let errors = template.get_error();
    assert!(template.has_error());
    assert_eq!(errors[0], "Error 131 (for) arguments not found  src: {:for; n :}");
    assert_eq!(errors[1], "The delimiter was not found: {:allow: none :}");
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_complete_tpl() {
    let schema = r#"
    {
        "config": {
            "comments": "keep"
        },
        "inherit": {
            "locale": {
                "current": "es",
                "trans": {
                    "es": {
                        "Title": "Título",
                        "ref:greeting-nts": "¡Hola!"
                    }
                }
            }
        }
    }
    "#.trim();
    let out = r#"
<!DOCTYPE html>
<html lang=es>
<head>
    <meta charset=UTF-8>
    <title>Lorem Ipsum Ok nts</title>
</head>
    <body>
        <div class="container">
            <h1>Lorem ipsum Título</h1>
            <div>
                nts
            </div>
                1:nts none
                2:
                    3:hello data nts
                        4:hello data nts
                            5:hello data nts
                                6:hello data nts
                                6
                            5
                        4
                    3
                2
                1:nts none
            <div>
        Lorem:
                Ipsum:
                        Dolor:
                                Sit:
                                        Amet=Consectetur adipiscing elit.
                                        Sed=Do eiusmod tempor incididunt.
                                        Ut=Labore et dolore magna aliqua.
                                        Array:
                                                0=Lorem
                                                1=Ipsum
                                                2=Dolor
                                Enim:
                                        Ad=Minim veniam, quis nostrud exercitation.
                                        Ullamco=Laboris nisi ut aliquip ex ea commodo consequat.
                                        Array:
                                                0=Sed
                                                1=Do
                                                2=Eiusmod
                                                3=Tempor
                                                4=Incididunt
                        Irure:
                                Dolor:
                                        In=Reprehenderit in voluptate.
                                        Excepteur=Sint occaecat cupidatat.
                                        Array:
                                                0=Ut
                                                1=Enim
                                                2=Ad
                Officia:
                        Deserunt:
                                Mollit:
                                        Anim:
                                                Id=Est laborum et dolorum fugiat nulla pariatur.
                                                Sed=Quis nostrud exercitation.
                                Commodo:
                                        Consequat=Duis aute irure dolor in reprehenderit.
                                        Array:
                                                0=Amet
                                                1=Sed
                                                2=Do
                                                3=Eiusmod
                                                4=Tempor
            </div>
            <div>
                is not traversal
                is traversal!
            </div>
            <div>
                    num 0 = 0
                    num 1 = 1
                    num 2 = 2
                    num 3 = 3
                    num 4 = 4
                    num 5 = 5
                    num 6 = 6
                    num 7 = 7
                    num 8 = 8
                    num 9 = 9
            </div>
        </div>
    </body>
</html>
"#.trim();
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.merge_schema_str(schema).unwrap();
    template.set_src_str("{:include; tests/complete.ntpl :}");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(template.get_status_code(), "200");
    assert_eq!(template.get_status_text(), "OK");
    assert_eq!(template.get_status_param(), "");
    assert_eq!(result, out);
}

#[test]
fn test_bif_same() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:same; /a/a/ >> is same :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is same</div>");
}

#[test]
fn test_bif_no_same() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:same; /a/b/ >> is same :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_no_same_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!same; /a/b/ >> not same :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>not same</div>");
}

#[test]
fn test_bif_same_evaluate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:same; /{:;__test-nts:}/{:;__test-nts:}/ >> {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_filled() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; __test-nts >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_obj_levels() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; __test-obj-nts->level1-obj->level2-obj->level2 >> {:;__test-obj-nts->level1-obj->level2-obj->level2:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Ok</div>");
}

#[test]
fn test_bif_filled_evaluate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; __test-{:;__test-nts:} >> {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_filled_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:+filled; __test-nts >> {:include; tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet</div></div>");
}

#[test]
fn test_bif_filled_no_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; __test-nts >> {:include; tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_true() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; true >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_false() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; false >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_text() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; text >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_zero() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; zero >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_one() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; one >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_spaces() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; spaces >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; empty >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_null() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; null >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_emptyarr() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; emptyarr >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_array() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; array >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_true_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::true >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_false_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::false >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_text_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::text >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_zero_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::zero >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_one_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::one >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_spaces_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::spaces >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_empty_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::empty >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_null_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::null >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_emptyarr_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::emptyarr >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_array_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::array >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_true_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; true >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_false_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; false >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_text_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; text >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_zero_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; zero >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_one_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; one >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_spaces_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; spaces >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_empty_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; empty >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not filled</div>");
}

#[test]
fn test_bif_filled_null_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; null >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not filled</div>");
}

#[test]
fn test_bif_filled_emptyarr_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; emptyarr >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not filled</div>");
}

#[test]
fn test_bif_filled_array_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; array >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_true_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::true >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_false_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::false >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_text_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::text >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_zero_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::zero >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_one_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::one >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_spaces_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::spaces >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_empty_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::empty >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not filled</div>");
}

#[test]
fn test_bif_filled_null_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::null >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not filled</div>");
}

#[test]
fn test_bif_filled_emptyarr_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::emptyarr >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not filled</div>");
}

#[test]
fn test_bif_filled_array_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::array >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_true() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; array->true >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_arr_false() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; array->false >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_arr_text() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; array->text >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_arr_zero() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; array->zero >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_arr_one() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; array->one >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_arr_spaces() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; array->spaces >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_arr_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; array->empty >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_null() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:filled; array->null >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_true_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::array->true >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_arr_false_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::array->false >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_arr_text_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::array->text >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_arr_zero_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::array->zero >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_arr_one_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::array->one >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_arr_spaces_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::array->spaces >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is filled</div>");
}

#[test]
fn test_bif_filled_arr_empty_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::array->empty >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_null_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:filled; local::array->null >> is filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_true_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; array->true >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_false_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; array->false >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_text_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; array->text >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_zero_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; array->zero >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_one_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; array->one >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_spaces_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; array->spaces >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_empty_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; array->empty >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not filled</div>");
}

#[test]
fn test_bif_filled_arr_null_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!filled; array->null >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not filled</div>");
}

#[test]
fn test_bif_filled_arr_true_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::array->true >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_false_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::array->false >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_text_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::array->text >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_zero_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::array->zero >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_one_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::array->one >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_spaces_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::array->spaces >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_filled_arr_empty_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::array->empty >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not filled</div>");
}

#[test]
fn test_bif_filled_arr_null_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!filled; local::array->null >> is not filled :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not filled</div>");
}

#[test]
fn test_bif_array() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; __test-obj-nts >> nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_array_obj_levels() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; __test-obj-nts->level1-obj->level2-obj >> Ok :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Ok</div>");
}

#[test]
fn test_bif_array_evaluate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; __test-obj-{:;__test-nts:} >> {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_array_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; __test-obj-nts >> nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_negate_undefined() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; undefined-var >> nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_array_obj_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; __test-obj-empty-nts >> nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_array_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:+array; __test-obj-nts >> {:include; tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet</div></div>");
}

#[test]
fn test_bif_array_no_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; __test-nts >> {:include; tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_true() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; true >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_false() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; false >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_text() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; text >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_zero() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; zero >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_one() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; one >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_spaces() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; spaces >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; empty >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_null() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; null >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_emptyarr() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; emptyarr >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is array</div>");
}

#[test]
fn test_bif_array_array() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; array >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is array</div>");
}

#[test]
fn test_bif_array_true_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::true >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_false_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::false >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_text_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::text >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_zero_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::zero >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_one_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::one >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_spaces_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::spaces >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_empty_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::empty >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_null_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::null >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_array_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::array >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is array</div>");
}

#[test]
fn test_bif_array_true_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; true >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_false_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; false >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_text_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; text >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_zero_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; zero >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_one_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; one >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_spaces_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; spaces >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_empty_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; empty >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_null_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; null >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_emptyarr_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; emptyarr >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_array_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; array >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_true_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::true >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_false_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::false >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_text_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::text >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_zero_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::zero >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_one_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::one >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_spaces_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::spaces >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_empty_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::empty >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_null_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::null >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_true() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; array->true >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_false() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; array->false >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_text() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; array->text >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_zero() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; array->zero >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_one() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; array->one >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_spaces() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; array->spaces >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; array->empty >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_null() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; array->null >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_emptyarr() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:array; array->empty >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_true_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::array->true >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_false_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::array->false >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_text_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::array->text >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_zero_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::array->zero >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_one_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::array->one >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_spaces_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::array->spaces >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_empty_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::array->empty >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_null_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:array; local::array->null >> is array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_array_arr_true_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; array->true >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_false_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; array->false >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_text_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; array->text >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_zero_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; array->zero >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_one_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; array->one >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_spaces_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; array->spaces >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_empty_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; array->empty >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_null_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; array->null >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_emptyarr_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!array; array->empty >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_true_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::array->true >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_false_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::array->false >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_text_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::array->text >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_zero_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::array->zero >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_one_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::array->one >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_spaces_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::array->spaces >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_empty_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::array->empty >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_array_arr_null_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!array; local::array->null >> is not array :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not array</div>");
}

#[test]
fn test_bif_bool() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; __test-nts >> nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_bool_obj_levels() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; __test-obj-nts->level1-obj->level2-obj->level2 >> {:;__test-obj-nts->level1-obj->level2-obj->level2:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Ok</div>");
}

#[test]
fn test_bif_bool_evaluate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; __test-{:;__test-nts:} >> {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_bool_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; __test-bool-false-string-nts >> nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_bool_negate_undefined() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; undefined-var >> nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_bool_obj() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; __test-obj_nts >> nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_bool_obj_empty_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; __test-obj-empty-nts >> nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_bool_obj_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; __test-obj-empty-nts >> nts :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:+bool; __test-nts >> {:include; tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet</div></div>");
}

#[test]
fn test_bif_bool_no_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; __test-nts >> {:include; tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_true() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; true >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_false() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; false >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_text() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; text >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_zero() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; zero >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_one() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; one >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_spaces() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; spaces >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; empty >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_null() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; null >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_emptyarr() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; emptyarr >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_array() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; array >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_true_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::true >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_false_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::false >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_text_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::text >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_zero_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::zero >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_one_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::one >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_spaces_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::spaces >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_empty_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::empty >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_null_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::null >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_emptyarr_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::emptyarr >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_array_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::array >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_true_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; true >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_false_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; false >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_text_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; text >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_zero_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; zero >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_one_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; one >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_spaces_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; spaces >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_empty_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; empty >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_null_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; null >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_emptyarr_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; emptyarr >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_array_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; array >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_true_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::true >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_false_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::false >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_text_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::text >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_zero_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::zero >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_one_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::one >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_spaces_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::spaces >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_empty_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::empty >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_null_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::null >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_emptyarr_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::emptyarr >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_array_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::array >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_true() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; array->true >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_arr_false() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; array->false >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_text() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; array->text >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_arr_zero() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; array->zero >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_one() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; array->one >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_arr_spaces() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; array->spaces >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_arr_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; array->empty >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_null() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:bool; array->null >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_true_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::array->true >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_arr_false_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::array->false >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_text_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::array->text >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_arr_zero_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::array->zero >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_one_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::array->one >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_arr_spaces_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::array->spaces >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is bool</div>");
}

#[test]
fn test_bif_bool_arr_empty_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::array->empty >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_null_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:bool; local::array->null >> is bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_true_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; array->true >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_false_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; array->false >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_arr_text_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; array->text >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_zero_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; array->zero >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_arr_one_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; array->one >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_spaces_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; array->spaces >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_empty_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; array->empty >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_arr_null_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!bool; array->null >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_arr_true_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::array->true >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_false_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::array->false >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_arr_text_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::array->text >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_zero_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::array->zero >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_arr_one_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::array->one >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_spaces_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::array->spaces >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_bool_arr_empty_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::array->empty >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_bool_arr_null_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!bool; local::array->null >> is not bool :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not bool</div>");
}

#[test]
fn test_bif_defined() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; __test-nts >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_undefined() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; undefined-var >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_undefined_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; undefined-var >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not defined</div>");
}

#[test]
fn test_bif_defined_obj_levels() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; __test-obj-nts->level1-obj->level2-obj->level2 >> {:;__test-obj-nts->level1-obj->level2-obj->level2:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>Ok</div>");
}

#[test]
fn test_bif_defined_evaluate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; __test-{:;__test-nts:} >> {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_defined_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:+defined; __test-nts >> {:include; tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div><div>test snippet</div></div>");
}

#[test]
fn test_bif_defined_no_scope() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; __test-nts >> {:include; tests/snippets.ntpl :} :}{:snippet; test-snippet :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_true() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; true >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_false() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; false >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_text() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; text >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_zero() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; zero >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_one() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; one >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_spaces() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; spaces >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; empty >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_null() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; null >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_emptyarr() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; emptyarr >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_array() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; array >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_true_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::true >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_false_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::false >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_text_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::text >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_zero_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::zero >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_one_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::one >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_spaces_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::spaces >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_empty_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::empty >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_null_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::null >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_emptyarr_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::emptyarr >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_array_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::array >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_true_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; true >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_false_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; false >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_text_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; text >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_zero_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; zero >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_one_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; one >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_spaces_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; spaces >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_empty_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; empty >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_null_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; null >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not defined</div>");
}

#[test]
fn test_bif_defined_emptyarr_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; emptyarr >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_array_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; array >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_true_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::true >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_false_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::false >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_text_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::text >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_zero_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::zero >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_one_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::one >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_spaces_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::spaces >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_empty_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::empty >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_null_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::null >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not defined</div>");
}

#[test]
fn test_bif_defined_emptyarr_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::emptyarr >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_array_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::array >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_true() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; array->true >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_false() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; array->false >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_text() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; array->text >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_zero() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; array->zero >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_one() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; array->one >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_spaces() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; array->spaces >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; array->empty >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_null() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:defined; array->null >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_true_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::array->true >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_false_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::array->false >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_text_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::array->text >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_zero_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::array->zero >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_one_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::array->one >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_spaces_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::array->spaces >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_empty_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::array->empty >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is defined</div>");
}

#[test]
fn test_bif_defined_arr_null_local() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:defined; local::array->null >> is defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_true_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; array->true >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_false_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; array->false >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_text_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; array->text >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_zero_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; array->zero >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_one_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; array->one >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_spaces_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; array->spaces >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_empty_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; array->empty >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_null_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!defined; array->null >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not defined</div>");
}

#[test]
fn test_bif_defined_arr_true_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::array->true >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_false_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::array->false >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_text_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::array->text >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_zero_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::array->zero >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_one_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::array->one >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_spaces_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::array->spaces >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_empty_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::array->empty >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_defined_arr_null_local_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:data; tests/local-data.json :}{:!defined; local::array->null >> is not defined :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>is not defined</div>");
}

#[test]
fn test_bif_contains() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:contains; /haystack/st/ >> contains :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>contains</div>");
}

#[test]
fn test_bif_no_contains() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:contains; /haystack/none/ >> contains :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_no_contains_negate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:!contains; /haystack/none/ >> not contains :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>not contains</div>");
}

#[test]
fn test_bif_contains_evaluate() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:contains; /{:;__test-nts:}/{:;__test-nts:}/ >> {:;__test-nts:} :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>nts</div>");
}

#[test]
fn test_bif_join() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:join; /__test-arr-nts/|/ :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>one|two|three</div>");
}

#[test]
fn test_bif_join_empty() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:join; /array->empty/|/ :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_join_no_array() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:join; /text/|/ :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div></div>");
}

#[test]
fn test_bif_join_keys_true() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:join; /__test-arr-nts/|/true/ :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>0|1|2</div>");
}

#[test]
fn test_bif_join_keys_false() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:join; /__test-arr-nts/|/false/ :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>one|two|three</div>");
}

#[test]
fn test_bif_join_eval() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:join; /__test-arr-nts/{:;__hello-nts:}/{:;array->zero:}/ :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>oneHello ntstwoHello ntsthree</div>");
}

#[test]
fn test_bif_join_eval_true() {
    let mut template = match neutralts::Template::new() {
        Ok(tpl) => tpl,
        Err(error) => {
            println!("Error creating Template: {}", error);
            assert!(false);
            return;
        }
    };
    template.merge_schema_str(SCHEMA).unwrap();
    template.set_src_str("<div>{:join; /__test-arr-nts/{:;__hello-nts:}/{:;array->one:}/ :}</div>");
    let result = template.render();
    assert!(!template.has_error());
    assert_eq!(result, "<div>0Hello nts1Hello nts2</div>");
}
