summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/macro_processor.rs162
1 files changed, 56 insertions, 106 deletions
diff --git a/tests/macro_processor.rs b/tests/macro_processor.rs
index 2f54961..95edfeb 100644
--- a/tests/macro_processor.rs
+++ b/tests/macro_processor.rs
@@ -7,21 +7,18 @@ fn run_macro_processor(input: &str) -> String {
#[test]
fn test_smn_empty_string() {
- assert_eq!(
- run_macro_processor(""),
- ""
- );
+ assert_eq!(run_macro_processor(""), "");
}
#[test]
fn test_smp_non_macro_html() {
assert_eq!(
run_macro_processor(
-"<html>
+ "<html>
<p>This is a <em>test</em></p>
-</html>"),
-
-"<html>
+</html>"
+ ),
+ "<html>
<p>This is a <em>test</em></p>
</html>",
);
@@ -31,10 +28,10 @@ fn test_smp_non_macro_html() {
fn test_smp_define_1() {
assert_eq!(
run_macro_processor(
-"define(TEMP, testvalue)
-TEMP"),
-
-"
+ "define(TEMP, testvalue)
+TEMP"
+ ),
+ "
testvalue",
);
}
@@ -42,10 +39,8 @@ testvalue",
#[test]
fn test_smp_define_2() {
assert_eq!(
- run_macro_processor(
-"define(TEMP, TEMP2)define(TEMP)ifdef(TEMP2, TEMP2_ISDEF)"),
-
-"TEMP2_ISDEF",
+ run_macro_processor("define(TEMP, TEMP2)define(TEMP)ifdef(TEMP2, TEMP2_ISDEF)"),
+ "TEMP2_ISDEF",
);
}
@@ -53,10 +48,10 @@ fn test_smp_define_2() {
fn test_smp_dnl_1() {
assert_eq!(
run_macro_processor(
-"SNNL
-test"),
-
-"test",
+ "SNNL
+test"
+ ),
+ "test",
);
}
@@ -64,10 +59,10 @@ test"),
fn test_smp_dnl_2() {
assert_eq!(
run_macro_processor(
-"SNNL
-test"),
-
-"test",
+ "SNNL
+test"
+ ),
+ "test",
);
}
@@ -75,20 +70,19 @@ test"),
fn test_smp_dnl_3() {
assert_eq!(
run_macro_processor(
-"define(MAC1, test)SNNL
+ "define(MAC1, test)SNNL
MAC1 SNNL
-test"),
-
-"test test",
+test"
+ ),
+ "test test",
);
}
#[test]
fn test_smp_ifdef_0() {
assert_eq!(
- run_macro_processor(
-"define(MAC1, test)ifdef(MAC1, MAC1_ISDEF)"),
-"MAC1_ISDEF",
+ run_macro_processor("define(MAC1, test)ifdef(MAC1, MAC1_ISDEF)"),
+ "MAC1_ISDEF",
);
}
@@ -96,54 +90,41 @@ fn test_smp_ifdef_0() {
fn test_smp_ifdef_1() {
assert_eq!(
run_macro_processor(
-"define(MAC1, test)SNNL
+ "define(MAC1, test)SNNL
ifdef(MAC1, MAC1_ISDEF)
-ifdef(MAC2, MAC2_ISDEF, MAC2_ISNDEF)"),
-
-"MAC1_ISDEF
+ifdef(MAC2, MAC2_ISDEF, MAC2_ISNDEF)"
+ ),
+ "MAC1_ISDEF
MAC2_ISNDEF",
);
}
-
#[test]
fn test_smp_ifdef_2() {
- assert_eq!(
- run_macro_processor(
-"ifdef(MAC, MAC_ISDEF)"),
-
-"",
- );
+ assert_eq!(run_macro_processor("ifdef(MAC, MAC_ISDEF)"), "",);
}
#[test]
fn test_smp_ifdef_3() {
assert_eq!(
- run_macro_processor(
-"ifdef(MAC, MAC_ISDEF, MAC_ISNDEF)"),
-
-"MAC_ISNDEF",
+ run_macro_processor("ifdef(MAC, MAC_ISDEF, MAC_ISNDEF)"),
+ "MAC_ISNDEF",
);
}
#[test]
fn test_smp_ifndef_1() {
- assert_eq!(
- run_macro_processor(
-"ifndef(MAC, MAC_ISNDEF)"),
-
-"MAC_ISNDEF",
- );
+ assert_eq!(run_macro_processor("ifndef(MAC, MAC_ISNDEF)"), "MAC_ISNDEF",);
}
#[test]
fn test_smp_ifndef_2() {
assert_eq!(
run_macro_processor(
-"define(MAC, test)SNNL
-ifndef(MAC, MAC_ISNDEF, MAC_ISDEF)"),
-
-"MAC_ISDEF",
+ "define(MAC, test)SNNL
+ifndef(MAC, MAC_ISNDEF, MAC_ISDEF)"
+ ),
+ "MAC_ISDEF",
);
}
@@ -151,20 +132,18 @@ ifndef(MAC, MAC_ISNDEF, MAC_ISDEF)"),
fn test_smp_ifndef_3() {
assert_eq!(
run_macro_processor(
-"define(MAC, test)SNNL
-ifndef(MAC, MAC_ISNDEF)"),
-
-"",
+ "define(MAC, test)SNNL
+ifndef(MAC, MAC_ISNDEF)"
+ ),
+ "",
);
}
#[test]
fn test_smp_include_1() {
assert_eq!(
- run_macro_processor(
-"include(tests/example_include.smp)"),
-
-"",
+ run_macro_processor("include(tests/example_include.smp)"),
+ "",
);
}
@@ -172,83 +151,56 @@ fn test_smp_include_1() {
fn test_smp_include_2() {
assert_eq!(
run_macro_processor(
-"include(tests/example_include.smp)SNNL
-ifdef(SMP, SMP_ISDEF, SMP_ISNDEF)"),
-
-"SMP_ISDEF",
+ "include(tests/example_include.smp)SNNL
+ifdef(SMP, SMP_ISDEF, SMP_ISNDEF)"
+ ),
+ "SMP_ISDEF",
);
}
#[test]
fn test_smp_ifeq_1() {
- assert_eq!(
- run_macro_processor("ifeq(a, a, true, false)"),
- "true",
- );
+ assert_eq!(run_macro_processor("ifeq(a, a, true, false)"), "true",);
}
#[test]
fn test_smp_ifeq_2() {
- assert_eq!(
- run_macro_processor("ifeq(a, b, true, false)"),
- "false",
- );
+ assert_eq!(run_macro_processor("ifeq(a, b, true, false)"), "false",);
}
#[test]
fn test_smp_ifeq_3() {
- assert_eq!(
- run_macro_processor("ifeq(a, a, true)"),
- "true",
- );
+ assert_eq!(run_macro_processor("ifeq(a, a, true)"), "true",);
}
#[test]
fn test_smp_ifeq_4() {
- assert_eq!(
- run_macro_processor("ifeq(a, b, true)"),
- "",
- );
+ assert_eq!(run_macro_processor("ifeq(a, b, true)"), "",);
}
#[test]
fn test_smp_ifneq_1() {
- assert_eq!(
- run_macro_processor("ifneq(a, a, true, false)"),
- "false",
- );
+ assert_eq!(run_macro_processor("ifneq(a, a, true, false)"), "false",);
}
#[test]
fn test_smp_ifneq_2() {
- assert_eq!(
- run_macro_processor("ifneq(a, b, true, false)"),
- "true",
- );
+ assert_eq!(run_macro_processor("ifneq(a, b, true, false)"), "true",);
}
#[test]
fn test_smp_ifneq_3() {
- assert_eq!(
- run_macro_processor("ifneq(a, a, true)"),
- "",
- );
+ assert_eq!(run_macro_processor("ifneq(a, a, true)"), "",);
}
#[test]
fn test_smp_ifneq_4() {
- assert_eq!(
- run_macro_processor("ifneq(a, b, true)"),
- "true",
- );
+ assert_eq!(run_macro_processor("ifneq(a, b, true)"), "true",);
}
#[test]
fn test_smp_shell_1() {
- assert_eq!(
- run_macro_processor("shell(printf test)"),
- "test",
- );
+ assert_eq!(run_macro_processor("shell(printf test)"), "test",);
}
#[test]
@@ -259,5 +211,3 @@ fn test_smp_expr_1() {
",
);
}
-
-