[vala/staging] tests: Add "unique namespace" test
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] tests: Add "unique namespace" test
- Date: Sat, 11 Jul 2020 17:06:58 +0000 (UTC)
commit 14cf269d58915c9f3c26155729807e241656790c
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Wed Jul 8 22:57:56 2020 +0200
tests: Add "unique namespace" test
A namespace symbol is unique for a given name in its CodeContext. This
means attributes are inherited accross all occurances.
tests/Makefile.am | 1 +
tests/namespace/unique.vala | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7d604cfbe..3867108ca 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -77,6 +77,7 @@ TESTS = \
basic-types/bug788775.vala \
constants/array-type-invalid.test \
constants/glog.vala \
+ namespace/unique.vala \
arrays/cast-silent-invalid.test \
arrays/class-field-length-cname.vala \
arrays/constant-element-access.vala \
diff --git a/tests/namespace/unique.vala b/tests/namespace/unique.vala
new file mode 100644
index 000000000..3ae410873
--- /dev/null
+++ b/tests/namespace/unique.vala
@@ -0,0 +1,16 @@
+namespace GLib {
+ public class ValaFoo {
+ }
+
+ public int vala_foo () {
+ return 42;
+ }
+}
+
+[CCode (cname = "g_vala_foo", cheader_filename = "glib.h")]
+extern int vala_foo ();
+
+void main () {
+ assert (vala_foo () == 42);
+ assert (typeof (ValaFoo).name () == "GValaFoo");
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]