[vala/0.40] tests: Add "pre/post-increment" tests to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.40] tests: Add "pre/post-increment" tests to increase coverage
- Date: Thu, 30 Jul 2020 11:02:58 +0000 (UTC)
commit 692c555e221b935289c0946fc20602b4ff8a5626
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Jul 14 14:13:51 2020 +0200
tests: Add "pre/post-increment" tests to increase coverage
tests/Makefile.am | 1 +
tests/control-flow/pre-post-increment.vala | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 65633c79e..35917b61a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -195,6 +195,7 @@ TESTS = \
control-flow/missing-break.test \
control-flow/missing-return.test \
control-flow/nested-conditional.vala \
+ control-flow/pre-post-increment.vala \
control-flow/switch.vala \
control-flow/sideeffects.vala \
control-flow/unassigned-captured-local-variable.test \
diff --git a/tests/control-flow/pre-post-increment.vala b/tests/control-flow/pre-post-increment.vala
new file mode 100644
index 000000000..e0bf28bcb
--- /dev/null
+++ b/tests/control-flow/pre-post-increment.vala
@@ -0,0 +1,21 @@
+void main () {
+ {
+ int i = 0;
+ i = i++ + 1;
+ assert (i == 1);
+ }
+ {
+ int i = 0;
+ assert (i++ == 0);
+ }
+ {
+ int i = 0;
+ i = ++i + 1;
+ assert (i == 2);
+ }
+ {
+ int i = 0;
+ assert (++i == 1);
+ }
+}
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]