meson.build 730 B

123456789101112131415161718192021
  1. project('foreach', 'c')
  2. tests = [['test1', 'prog1', 'prog1.c'],
  3. ['test2', 'prog2', 'prog2.c', 'fallback'],
  4. ['test3', 'prog3', 'prog3.c', 'urgh']]
  5. assert(tests[0].get(3, 'fallbck') == 'fallbck', 'array #1 fallback did not match')
  6. assert(tests[1].get(3, 'failbk') == 'fallback', 'array #2 value did not match')
  7. assert(tests[2].get(3, 'urgh') == 'urgh', 'array #3 value did not match')
  8. foreach i : tests
  9. test(i.get(0), executable(i.get(1), i.get(2), install : true))
  10. # Ensure that changing the tests variable does not
  11. # affect ongoing iteration in the foreach loop.
  12. #
  13. # Being able to do that would make Meson Turing complete and
  14. # we definitely don't want that.
  15. tests = ['test4', 'prog4', 'prog4.c']
  16. endforeach