const gi = require('../lib/')
const GLib = gi.require('GLib', '2.0')
const common = require('./__common__.js')

common.describe('get output arguments type struct', () => {
  // transfer = NOTHING
  const [res0, time] = GLib.timeValFromIso8601('2020-06-22T09:50:37Z')
  const isoString = time.toIso8601()
  common.expect(isoString, '2020-06-22T09:50:37Z')

  // transfer = EVERYTHING
  const regex = new GLib.Regex('[A-Z]+', 0, 0)
  const [res1, match] = regex.match('Hello World', 0)
  const matches = []
  while (match.matches()) {
    const word = match.fetch(0)
    matches.push(word)
    match.next(null)
  }
  match.free()
  regex.unref()

  common.expect(matches.length, 2)
  common.expect(matches[0], 'H')
  common.expect(matches[1], 'W')
})

@@ -23,16 +23,61 @@
 /lib/')%0A
+const GObject = gi.require('GObject', '2.0')%0A
 const GL
@@ -113,22 +113,40 @@
 )%0Aconst 
-common
+%7B describe, expect, it %7D
  = requi
@@ -168,23 +168,16 @@
 _.js')%0A%0A
-common.
 describe
@@ -221,20 +221,33 @@
 () =%3E %7B%0A
+%0A
   
-//
+it('works with
  transfe
@@ -253,17 +253,32 @@
 er =
- 
+= %22
 NOTHING
-%0A
+%22', () =%3E %7B%0A  
   co
@@ -344,16 +344,18 @@
 0:37Z')%0A
+  
   const 
@@ -381,31 +381,26 @@
 Iso8601()%0A  
-common.
+  
 expect(isoSt
@@ -432,14 +432,34 @@
 7Z')
+%0A  %7D)
 %0A%0A  //
+ it('works with
  tra
@@ -465,17 +465,19 @@
 ansfer =
+=
  
+%22
 EVERYTHI
@@ -482,371 +482,697 @@
 HING
-%0A  const regex = new GLib.Regex('%5BA-Z%5D+', 0, 0)%0A  const %5Bres1, match%5D = regex.match('Hello World', 0)%0A  const matches = %5B%5D%0A  while (match.matches()) %7B
+%22', () =%3E %7B%7D)%0A  // it('works with transfer == %22CONTAINER%22',  () =%3E %7B%7D)%0A%0A  /*%0A   * No viable candidate found for the cases above, but some%0A   * might be found by investagating more libraries. This script%0A   * will return candidates:%0A   * @example
 %0A  
+ *
   
+ 
 const 
-word = match.fetch(0)%0A    matches.push(word)%0A    match.next(null
+i = require('../lib/inspect')%0A   *%0A   *   i.parseNamespace('Gtk', '3.0')%0A   *   // i.parseNamespace(...
 )%0A  
-%7D%0A  match.free()%0A  regex.unref()%0A%0A  common.expect(matches.length, 2)%0A  common.expect(matches%5B0%5D, 'H')%0A  common.expect(matches%5B1%5D, 'W')
+ *%0A   *   const candidates = i.infos.filter(i =%3E%0A   *     i.infoType === 'function'%0A   *     && i.n_args %3E 0%0A   *     && !i.isConstructor%0A   *     && i.args.some(a =%3E%0A   *       (a.direction === 'OUT' %7C%7C a.direction === 'INOUT')%0A   *       && a.transfer !== 'NOTHING'%0A   *       && a.type.startsWith('struct.')))%0A   *%0A   */
 %0A%7D)%0A

remove invalid test