aboutsummaryrefslogtreecommitdiff
path: root/tests/icon/reject
diff options
context:
space:
mode:
Diffstat (limited to 'tests/icon/reject')
-rw-r--r--tests/icon/reject/bad_delimiter_replacement.expected1
-rw-r--r--tests/icon/reject/bad_delimiter_replacement.zc9
-rw-r--r--tests/icon/reject/bind_function.expected1
-rw-r--r--tests/icon/reject/bind_function.zc10
-rw-r--r--tests/icon/reject/bind_pointer.expected1
-rw-r--r--tests/icon/reject/bind_pointer.zc10
-rw-r--r--tests/icon/reject/expression_boundary.expected1
-rw-r--r--tests/icon/reject/expression_boundary.zc8
-rw-r--r--tests/icon/reject/implicit_global.expected1
-rw-r--r--tests/icon/reject/implicit_global.zc11
-rw-r--r--tests/icon/reject/incomplete_expression.expected1
-rw-r--r--tests/icon/reject/incomplete_expression.zc8
-rw-r--r--tests/icon/reject/multiple_bindings.expected1
-rw-r--r--tests/icon/reject/multiple_bindings.zc9
-rw-r--r--tests/icon/reject/non_declaration.expected1
-rw-r--r--tests/icon/reject/non_declaration.zc9
-rw-r--r--tests/icon/reject/null_inputs.expected4
-rw-r--r--tests/icon/reject/null_inputs.zc10
-rw-r--r--tests/icon/reject/publication_return_type.expected1
-rw-r--r--tests/icon/reject/publication_return_type.zc11
-rw-r--r--tests/icon/reject/publication_signature.expected1
-rw-r--r--tests/icon/reject/publication_signature.zc11
-rw-r--r--tests/icon/reject/range.expected1
-rw-r--r--tests/icon/reject/range.zc9
-rw-r--r--tests/icon/reject/sized_frame.expected1
-rw-r--r--tests/icon/reject/sized_frame.zc11
-rw-r--r--tests/icon/reject/step_else_side_effect.expected1
-rw-r--r--tests/icon/reject/step_else_side_effect.zc12
-rw-r--r--tests/icon/reject/step_local_mutation.expected1
-rw-r--r--tests/icon/reject/step_local_mutation.zc11
-rw-r--r--tests/icon/reject/step_multiple_bindings.expected1
-rw-r--r--tests/icon/reject/step_multiple_bindings.zc10
-rw-r--r--tests/icon/reject/type_name_binding.expected1
-rw-r--r--tests/icon/reject/type_name_binding.zc9
-rw-r--r--tests/icon/reject/unbalanced.expected1
-rw-r--r--tests/icon/reject/unbalanced.zc8
-rw-r--r--tests/icon/reject/unknown_pattern.expected1
-rw-r--r--tests/icon/reject/unknown_pattern.zc9
-rw-r--r--tests/icon/reject/unresolved_capture.expected1
-rw-r--r--tests/icon/reject/unresolved_capture.zc9
-rw-r--r--tests/icon/reject/unsupported_step.expected1
-rw-r--r--tests/icon/reject/unsupported_step.zc10
42 files changed, 228 insertions, 0 deletions
diff --git a/tests/icon/reject/bad_delimiter_replacement.expected b/tests/icon/reject/bad_delimiter_replacement.expected
new file mode 100644
index 0000000..363c912
--- /dev/null
+++ b/tests/icon/reject/bad_delimiter_replacement.expected
@@ -0,0 +1 @@
+1 1 3
diff --git a/tests/icon/reject/bad_delimiter_replacement.zc b/tests/icon/reject/bad_delimiter_replacement.zc
new file mode 100644
index 0000000..faffd90
--- /dev/null
+++ b/tests/icon/reject/bad_delimiter_replacement.zc
@@ -0,0 +1,9 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("return 3;"), pattern = run.tokens("$int"), replacement = run.tokens("(");
+ let edited = icon.rewrite(q, pattern, replacement);
+ rt.put_n(edited == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(' '); rt.put_n(run.eval(q)); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/bind_function.expected b/tests/icon/reject/bind_function.expected
new file mode 100644
index 0000000..65cd68b
--- /dev/null
+++ b/tests/icon/reject/bind_function.expected
@@ -0,0 +1 @@
+0 2
diff --git a/tests/icon/reject/bind_function.zc b/tests/icon/reject/bind_function.zc
new file mode 100644
index 0000000..1348c90
--- /dev/null
+++ b/tests/icon/reject/bind_function.zc
@@ -0,0 +1,10 @@
+include rt;
+include run;
+include icon;
+int target() { return 1; }
+fn main() {
+ let q = run.tokens("return 0;"), frame = icon.begin(q);
+ rt.put_n(icon.bind_global(frame, "target")); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ icon.close(d*frame);
+ return 0;
+}
diff --git a/tests/icon/reject/bind_pointer.expected b/tests/icon/reject/bind_pointer.expected
new file mode 100644
index 0000000..6517ee9
--- /dev/null
+++ b/tests/icon/reject/bind_pointer.expected
@@ -0,0 +1 @@
+0 2 preserved
diff --git a/tests/icon/reject/bind_pointer.zc b/tests/icon/reject/bind_pointer.zc
new file mode 100644
index 0000000..4834dde
--- /dev/null
+++ b/tests/icon/reject/bind_pointer.zc
@@ -0,0 +1,10 @@
+include rt;
+include run;
+include icon;
+char* message = "preserved";
+fn main() {
+ let q = run.tokens("return 0;"), frame = icon.begin(q);
+ rt.put_n(icon.bind_global(frame, "message")); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(' '); rt.put_s(message); rt.put_c(10);
+ icon.close(d*frame);
+ return 0;
+}
diff --git a/tests/icon/reject/expression_boundary.expected b/tests/icon/reject/expression_boundary.expected
new file mode 100644
index 0000000..65cd68b
--- /dev/null
+++ b/tests/icon/reject/expression_boundary.expected
@@ -0,0 +1 @@
+0 2
diff --git a/tests/icon/reject/expression_boundary.zc b/tests/icon/reject/expression_boundary.zc
new file mode 100644
index 0000000..5c84dbd
--- /dev/null
+++ b/tests/icon/reject/expression_boundary.zc
@@ -0,0 +1,8 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("(7)");
+ rt.put_n(icon.calculate(q, 0, 2)); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/implicit_global.expected b/tests/icon/reject/implicit_global.expected
new file mode 100644
index 0000000..3ff996e
--- /dev/null
+++ b/tests/icon/reject/implicit_global.expected
@@ -0,0 +1 @@
+0 2 5
diff --git a/tests/icon/reject/implicit_global.zc b/tests/icon/reject/implicit_global.zc
new file mode 100644
index 0000000..ce8e25d
--- /dev/null
+++ b/tests/icon/reject/implicit_global.zc
@@ -0,0 +1,11 @@
+include rt;
+include run;
+include icon;
+int hidden = 41;
+fn main() {
+ let q = run.tokens("return hidden;");
+ let f = icon.begin(q);
+ rt.put_n(icon.step(f)); rt.put_c(' '); rt.put_n(icon.state(f)); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ icon.close(d*f);
+ return 0;
+}
diff --git a/tests/icon/reject/incomplete_expression.expected b/tests/icon/reject/incomplete_expression.expected
new file mode 100644
index 0000000..65cd68b
--- /dev/null
+++ b/tests/icon/reject/incomplete_expression.expected
@@ -0,0 +1 @@
+0 2
diff --git a/tests/icon/reject/incomplete_expression.zc b/tests/icon/reject/incomplete_expression.zc
new file mode 100644
index 0000000..8a0366c
--- /dev/null
+++ b/tests/icon/reject/incomplete_expression.zc
@@ -0,0 +1,8 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("1 +");
+ rt.put_n(icon.calculate(q, 0, q[0])); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/multiple_bindings.expected b/tests/icon/reject/multiple_bindings.expected
new file mode 100644
index 0000000..43cebf1
--- /dev/null
+++ b/tests/icon/reject/multiple_bindings.expected
@@ -0,0 +1 @@
+1 2 2
diff --git a/tests/icon/reject/multiple_bindings.zc b/tests/icon/reject/multiple_bindings.zc
new file mode 100644
index 0000000..2b7b5e0
--- /dev/null
+++ b/tests/icon/reject/multiple_bindings.zc
@@ -0,0 +1,9 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("int a = 1, b = 2; return b;");
+ let changed = icon.undeclare(q, "a");
+ rt.put_n(changed == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(' '); rt.put_n(run.eval(q)); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/non_declaration.expected b/tests/icon/reject/non_declaration.expected
new file mode 100644
index 0000000..8d04f96
--- /dev/null
+++ b/tests/icon/reject/non_declaration.expected
@@ -0,0 +1 @@
+1 2
diff --git a/tests/icon/reject/non_declaration.zc b/tests/icon/reject/non_declaration.zc
new file mode 100644
index 0000000..b4233f9
--- /dev/null
+++ b/tests/icon/reject/non_declaration.zc
@@ -0,0 +1,9 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("rt.put_n(n); return 0;");
+ let changed = icon.undeclare(q, "n");
+ rt.put_n(changed == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/null_inputs.expected b/tests/icon/reject/null_inputs.expected
new file mode 100644
index 0000000..75f3fe4
--- /dev/null
+++ b/tests/icon/reject/null_inputs.expected
@@ -0,0 +1,4 @@
+0 2
+1 2
+1 2
+1 2
diff --git a/tests/icon/reject/null_inputs.zc b/tests/icon/reject/null_inputs.zc
new file mode 100644
index 0000000..41a7c4e
--- /dev/null
+++ b/tests/icon/reject/null_inputs.zc
@@ -0,0 +1,10 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ rt.put_n(icon.calculate(0, 0, 1)); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ let a = icon.undeclare(0, "n"); rt.put_n(a == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ let b = icon.change_type(0, "n", 0); rt.put_n(b == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ let c = icon.insert_block(0, 0, 0); rt.put_n(c == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/publication_return_type.expected b/tests/icon/reject/publication_return_type.expected
new file mode 100644
index 0000000..3f070c0
--- /dev/null
+++ b/tests/icon/reject/publication_return_type.expected
@@ -0,0 +1 @@
+0 4
diff --git a/tests/icon/reject/publication_return_type.zc b/tests/icon/reject/publication_return_type.zc
new file mode 100644
index 0000000..03822c5
--- /dev/null
+++ b/tests/icon/reject/publication_return_type.zc
@@ -0,0 +1,11 @@
+include rt;
+include run;
+include icon;
+typecheck on;
+int target() { return 4; }
+fn main() {
+ let pattern = run.tokens("return $int;"), replacement = run.tokens("return \"invalid\";");
+ rt.put_n(icon.find_replace(target, pattern, replacement)); rt.put_c(' ');
+ rt.put_n(target()); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/publication_signature.expected b/tests/icon/reject/publication_signature.expected
new file mode 100644
index 0000000..3f070c0
--- /dev/null
+++ b/tests/icon/reject/publication_signature.expected
@@ -0,0 +1 @@
+0 4
diff --git a/tests/icon/reject/publication_signature.zc b/tests/icon/reject/publication_signature.zc
new file mode 100644
index 0000000..01646e0
--- /dev/null
+++ b/tests/icon/reject/publication_signature.zc
@@ -0,0 +1,11 @@
+include rt;
+include run;
+include icon;
+typecheck on;
+int target(int value) { return value + 1; }
+fn main() {
+ let replacement = run.tokens("int target(char* value) { return 9; }");
+ rt.put_n(run.replace_function(target, replacement)); rt.put_c(' ');
+ rt.put_n(target(3)); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/range.expected b/tests/icon/reject/range.expected
new file mode 100644
index 0000000..8d04f96
--- /dev/null
+++ b/tests/icon/reject/range.expected
@@ -0,0 +1 @@
+1 2
diff --git a/tests/icon/reject/range.zc b/tests/icon/reject/range.zc
new file mode 100644
index 0000000..42bc0f4
--- /dev/null
+++ b/tests/icon/reject/range.zc
@@ -0,0 +1,9 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("return 1;"), r = run.tokens("2");
+ let changed = icon.splice(q, -1, 1, r);
+ rt.put_n(changed == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/sized_frame.expected b/tests/icon/reject/sized_frame.expected
new file mode 100644
index 0000000..a57b07e
--- /dev/null
+++ b/tests/icon/reject/sized_frame.expected
@@ -0,0 +1 @@
+2 5
diff --git a/tests/icon/reject/sized_frame.zc b/tests/icon/reject/sized_frame.zc
new file mode 100644
index 0000000..43e44fa
--- /dev/null
+++ b/tests/icon/reject/sized_frame.zc
@@ -0,0 +1,11 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("i8 n = 300; return n;");
+ let frame = icon.begin(q);
+ icon.step(frame);
+ rt.put_n(icon.state(frame)); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ icon.close(d*frame);
+ return 0;
+}
diff --git a/tests/icon/reject/step_else_side_effect.expected b/tests/icon/reject/step_else_side_effect.expected
new file mode 100644
index 0000000..c24938b
--- /dev/null
+++ b/tests/icon/reject/step_else_side_effect.expected
@@ -0,0 +1 @@
+0 2 0
diff --git a/tests/icon/reject/step_else_side_effect.zc b/tests/icon/reject/step_else_side_effect.zc
new file mode 100644
index 0000000..43c0d5d
--- /dev/null
+++ b/tests/icon/reject/step_else_side_effect.zc
@@ -0,0 +1,12 @@
+include rt;
+include run;
+include icon;
+int calls;
+int condition() { calls++; return 1; }
+fn main() {
+ let q = run.tokens("if (condition()) { return 1; } else return 2;");
+ let f = icon.begin(q);
+ rt.put_n(icon.step(f)); rt.put_c(' '); rt.put_n(icon.state(f)); rt.put_c(' '); rt.put_n(calls); rt.put_c(10);
+ icon.close(d*f);
+ return 0;
+}
diff --git a/tests/icon/reject/step_local_mutation.expected b/tests/icon/reject/step_local_mutation.expected
new file mode 100644
index 0000000..f8c518e
--- /dev/null
+++ b/tests/icon/reject/step_local_mutation.expected
@@ -0,0 +1 @@
+0 2 1
diff --git a/tests/icon/reject/step_local_mutation.zc b/tests/icon/reject/step_local_mutation.zc
new file mode 100644
index 0000000..6ef0a51
--- /dev/null
+++ b/tests/icon/reject/step_local_mutation.zc
@@ -0,0 +1,11 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("int n = 1; return n++;");
+ let f = icon.begin(q);
+ icon.step(f);
+ rt.put_n(icon.step(f)); rt.put_c(' '); rt.put_n(icon.state(f)); rt.put_c(' '); rt.put_n(icon.local(f, "n")); rt.put_c(10);
+ icon.close(d*f);
+ return 0;
+}
diff --git a/tests/icon/reject/step_multiple_bindings.expected b/tests/icon/reject/step_multiple_bindings.expected
new file mode 100644
index 0000000..057d934
--- /dev/null
+++ b/tests/icon/reject/step_multiple_bindings.expected
@@ -0,0 +1 @@
+0 2 5 0
diff --git a/tests/icon/reject/step_multiple_bindings.zc b/tests/icon/reject/step_multiple_bindings.zc
new file mode 100644
index 0000000..d1dba73
--- /dev/null
+++ b/tests/icon/reject/step_multiple_bindings.zc
@@ -0,0 +1,10 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("int n = 1, m = 2;");
+ let f = icon.begin(q);
+ rt.put_n(icon.step(f)); rt.put_c(' '); rt.put_n(icon.state(f)); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(' '); rt.put_n(icon.local_count(f)); rt.put_c(10);
+ icon.close(d*f);
+ return 0;
+}
diff --git a/tests/icon/reject/type_name_binding.expected b/tests/icon/reject/type_name_binding.expected
new file mode 100644
index 0000000..8d04f96
--- /dev/null
+++ b/tests/icon/reject/type_name_binding.expected
@@ -0,0 +1 @@
+1 2
diff --git a/tests/icon/reject/type_name_binding.zc b/tests/icon/reject/type_name_binding.zc
new file mode 100644
index 0000000..7ee62a9
--- /dev/null
+++ b/tests/icon/reject/type_name_binding.zc
@@ -0,0 +1,9 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("int* pointer;");
+ let r = icon.undeclare(q, "int");
+ rt.put_n(r == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/unbalanced.expected b/tests/icon/reject/unbalanced.expected
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tests/icon/reject/unbalanced.expected
@@ -0,0 +1 @@
+0
diff --git a/tests/icon/reject/unbalanced.zc b/tests/icon/reject/unbalanced.zc
new file mode 100644
index 0000000..d6ab110
--- /dev/null
+++ b/tests/icon/reject/unbalanced.zc
@@ -0,0 +1,8 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("return (1 + 2;");
+ rt.put_n(icon.validate(q)); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/unknown_pattern.expected b/tests/icon/reject/unknown_pattern.expected
new file mode 100644
index 0000000..2fb73a0
--- /dev/null
+++ b/tests/icon/reject/unknown_pattern.expected
@@ -0,0 +1 @@
+1 1
diff --git a/tests/icon/reject/unknown_pattern.zc b/tests/icon/reject/unknown_pattern.zc
new file mode 100644
index 0000000..74850c3
--- /dev/null
+++ b/tests/icon/reject/unknown_pattern.zc
@@ -0,0 +1,9 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("return 1;"), pattern = run.tokens("$unknown"), replacement = run.tokens("2");
+ let changed = icon.rewrite(q, pattern, replacement);
+ rt.put_n(changed == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/unresolved_capture.expected b/tests/icon/reject/unresolved_capture.expected
new file mode 100644
index 0000000..4ef63d7
--- /dev/null
+++ b/tests/icon/reject/unresolved_capture.expected
@@ -0,0 +1 @@
+1 3 3
diff --git a/tests/icon/reject/unresolved_capture.zc b/tests/icon/reject/unresolved_capture.zc
new file mode 100644
index 0000000..71584e3
--- /dev/null
+++ b/tests/icon/reject/unresolved_capture.zc
@@ -0,0 +1,9 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("return 1 + 2;"), p = run.tokens("$int + $int"), r = run.tokens("$missing");
+ let changed = icon.rewrite(q, p, r);
+ rt.put_n(changed == 0); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(' '); rt.put_n(run.eval(q)); rt.put_c(10);
+ return 0;
+}
diff --git a/tests/icon/reject/unsupported_step.expected b/tests/icon/reject/unsupported_step.expected
new file mode 100644
index 0000000..a57b07e
--- /dev/null
+++ b/tests/icon/reject/unsupported_step.expected
@@ -0,0 +1 @@
+2 5
diff --git a/tests/icon/reject/unsupported_step.zc b/tests/icon/reject/unsupported_step.zc
new file mode 100644
index 0000000..944c5b6
--- /dev/null
+++ b/tests/icon/reject/unsupported_step.zc
@@ -0,0 +1,10 @@
+include rt;
+include run;
+include icon;
+fn main() {
+ let q = run.tokens("for (int i = 0; i < 2; i++) {}");
+ let frame = icon.begin(q);
+ icon.step(frame); rt.put_n(icon.state(frame)); rt.put_c(' '); rt.put_n(icon.error()); rt.put_c(10);
+ icon.close(d*frame);
+ return 0;
+}