meson.build 448 B

123456789101112131415161718192021222324
  1. project('dict test', 'c')
  2. dict = {'foo' : 'bar',
  3. 'baz' : 'foo',
  4. 'foo bar': 'baz'}
  5. exe = executable('prog', sources : ['prog.c'])
  6. i = 0
  7. foreach key, value : dict
  8. test('dict test @0@'.format(key), exe,
  9. args : [dict[key], value])
  10. i += 1
  11. endforeach
  12. assert(i == 3, 'There should be three elements in that dictionary')
  13. empty_dict = {}
  14. foreach key, value : empty_dict
  15. assert(false, 'This dict should be empty')
  16. endforeach