[vala/wip/ricotz: 3/3] tests: More cases of FormatArg functions



commit e059068f307b8d812d063e485a04123689d4a0fd
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Nov 7 20:49:14 2016 +0100

    tests: More cases of FormatArg functions

 tests/methods/bug774060.vala |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/tests/methods/bug774060.vala b/tests/methods/bug774060.vala
index 84ab9c6..fe025e5 100644
--- a/tests/methods/bug774060.vala
+++ b/tests/methods/bug774060.vala
@@ -1,7 +1,33 @@
+class Foo : Object {
+       public unowned string format (string bar, int baz, [FormatArg] string format) {
+               return format;
+       }
+
+       [CCode (instance_pos = -1)]
+       public unowned string format_pos (string bar, int baz, [FormatArg] string format) {
+               return format;
+       }
+
+       [NoWrapper]
+       public virtual unowned string format_virtual (string bar, int baz, [FormatArg] string format) {
+               return format;
+       }
+
+       public static unowned string format_static (string foo, int baz, [FormatArg] string format) {
+               return format;
+       }
+}
+
 unowned string format_wrapper ([FormatArg] string format) {
        return format;
 }
 
 void main () {
        print (format_wrapper ("%d"), 42);
+
+       var foo = new Foo ();
+       print (foo.format ("", 0, "%d"), 42);
+       print (foo.format_pos ("", 0, "%d"), 42);
+       print (foo.format_virtual ("", 0, "%d"), 42);
+       print (Foo.format_static ("", 0, "%d"), 42);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]