summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorQrius <[email protected]>2024-09-26 00:11:05 +0200
committerQrius <[email protected]>2024-09-26 00:11:05 +0200
commit3b35f97b07d3a6b439544097fe36628619f95d4f (patch)
tree3ae0eca22cd3dcaef0d7f43efb0c6f0d3c738dac /tests
parent541f983def407f1f2a3ebed859e37d9f00c83111 (diff)
downloadskaldpress-3b35f97b07d3a6b439544097fe36628619f95d4f.tar.gz
skaldpress-3b35f97b07d3a6b439544097fe36628619f95d4f.zip
Change way macros are invoked, add a bunch of tests
Diffstat (limited to 'tests')
-rw-r--r--tests/example_include.smp2
-rw-r--r--tests/macro_processor.rs55
2 files changed, 38 insertions, 19 deletions
diff --git a/tests/example_include.smp b/tests/example_include.smp
index ce45d39..f38b21f 100644
--- a/tests/example_include.smp
+++ b/tests/example_include.smp
@@ -1 +1 @@
-define(SMP)DNL
+define(SMP)SNNL
diff --git a/tests/macro_processor.rs b/tests/macro_processor.rs
index 0c3651c..2f54961 100644
--- a/tests/macro_processor.rs
+++ b/tests/macro_processor.rs
@@ -53,7 +53,7 @@ fn test_smp_define_2() {
fn test_smp_dnl_1() {
assert_eq!(
run_macro_processor(
-"DNL
+"SNNL
test"),
"test",
@@ -64,7 +64,7 @@ test"),
fn test_smp_dnl_2() {
assert_eq!(
run_macro_processor(
-"DNL
+"SNNL
test"),
"test",
@@ -75,8 +75,8 @@ test"),
fn test_smp_dnl_3() {
assert_eq!(
run_macro_processor(
-"define(MAC1, test)DNL
-MAC1 DNL
+"define(MAC1, test)SNNL
+MAC1 SNNL
test"),
"test test",
@@ -96,7 +96,7 @@ fn test_smp_ifdef_0() {
fn test_smp_ifdef_1() {
assert_eq!(
run_macro_processor(
-"define(MAC1, test)DNL
+"define(MAC1, test)SNNL
ifdef(MAC1, MAC1_ISDEF)
ifdef(MAC2, MAC2_ISDEF, MAC2_ISNDEF)"),
@@ -140,7 +140,7 @@ fn test_smp_ifndef_1() {
fn test_smp_ifndef_2() {
assert_eq!(
run_macro_processor(
-"define(MAC, test)DNL
+"define(MAC, test)SNNL
ifndef(MAC, MAC_ISNDEF, MAC_ISDEF)"),
"MAC_ISDEF",
@@ -151,7 +151,7 @@ ifndef(MAC, MAC_ISNDEF, MAC_ISDEF)"),
fn test_smp_ifndef_3() {
assert_eq!(
run_macro_processor(
-"define(MAC, test)DNL
+"define(MAC, test)SNNL
ifndef(MAC, MAC_ISNDEF)"),
"",
@@ -159,7 +159,7 @@ ifndef(MAC, MAC_ISNDEF)"),
}
#[test]
-fn test_include_1() {
+fn test_smp_include_1() {
assert_eq!(
run_macro_processor(
"include(tests/example_include.smp)"),
@@ -169,10 +169,10 @@ fn test_include_1() {
}
#[test]
-fn test_include_2() {
+fn test_smp_include_2() {
assert_eq!(
run_macro_processor(
-"include(tests/example_include.smp)DNL
+"include(tests/example_include.smp)SNNL
ifdef(SMP, SMP_ISDEF, SMP_ISNDEF)"),
"SMP_ISDEF",
@@ -180,7 +180,7 @@ ifdef(SMP, SMP_ISDEF, SMP_ISNDEF)"),
}
#[test]
-fn test_ifeq_1() {
+fn test_smp_ifeq_1() {
assert_eq!(
run_macro_processor("ifeq(a, a, true, false)"),
"true",
@@ -188,7 +188,7 @@ fn test_ifeq_1() {
}
#[test]
-fn test_ifeq_2() {
+fn test_smp_ifeq_2() {
assert_eq!(
run_macro_processor("ifeq(a, b, true, false)"),
"false",
@@ -196,7 +196,7 @@ fn test_ifeq_2() {
}
#[test]
-fn test_ifeq_3() {
+fn test_smp_ifeq_3() {
assert_eq!(
run_macro_processor("ifeq(a, a, true)"),
"true",
@@ -204,7 +204,7 @@ fn test_ifeq_3() {
}
#[test]
-fn test_ifeq_4() {
+fn test_smp_ifeq_4() {
assert_eq!(
run_macro_processor("ifeq(a, b, true)"),
"",
@@ -212,7 +212,7 @@ fn test_ifeq_4() {
}
#[test]
-fn test_ifneq_1() {
+fn test_smp_ifneq_1() {
assert_eq!(
run_macro_processor("ifneq(a, a, true, false)"),
"false",
@@ -220,7 +220,7 @@ fn test_ifneq_1() {
}
#[test]
-fn test_ifneq_2() {
+fn test_smp_ifneq_2() {
assert_eq!(
run_macro_processor("ifneq(a, b, true, false)"),
"true",
@@ -228,7 +228,7 @@ fn test_ifneq_2() {
}
#[test]
-fn test_ifneq_3() {
+fn test_smp_ifneq_3() {
assert_eq!(
run_macro_processor("ifneq(a, a, true)"),
"",
@@ -236,9 +236,28 @@ fn test_ifneq_3() {
}
#[test]
-fn test_ifneq_4() {
+fn test_smp_ifneq_4() {
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",
+ );
+}
+
+#[test]
+fn test_smp_expr_1() {
+ assert_eq!(
+ run_macro_processor("expr(1, +, 1)"),
+ "2
+",
+ );
+}
+
+