]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: More cases of FormatArg functions
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 7 Nov 2016 19:49:14 +0000 (20:49 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 7 Nov 2016 20:27:36 +0000 (21:27 +0100)
tests/methods/bug774060.vala

index 84ab9c6651f2f00082a412c84f435380b156ac01..fe025e50c19414405c8c9d508d00cbd8f4adf21a 100644 (file)
@@ -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);
 }