Debian Codegraph @

test cases/vala/30 dependencies for compiler.links/meson.build

raw
1 project('dependency-link-test', ['c', 'vala'], version: '0.1')
2
3 valac = meson.get_compiler('vala')
4 gee_dep = dependency('gee-0.8', required : false)
5
6 code = '''void main() {
7 var a=new Gee.ArrayList<int> ();
8 a.add (42);
9 stdout.printf("%i",a[0]);}'''
10
11 if gee_dep.found()
12 # test 1; code should link
13 code_links = valac.links(
14 code,
15 dependencies : [gee_dep],
16 name: 'links with gee-0.8 library? == YES',
17 )
18 assert (code_links, 'gee-0.8 library should link successfully.')
19 endif
20
21 # test 2; code should not link
22 code_links = valac.links(
23 code,
24 name: 'links with gee library? == NO',
25 )
26 assert (not code_links, 'gee-0.8 library should not link successfully.')
27
28 math_dep = meson.get_compiler('c').find_library('m', required : false)
29 glib_dep = dependency('glib-2.0', required : false)
30
31 code = '''void main() {
32 var a=GLib.Math.cos (GLib.Math.PI / 3);
33 stdout.printf("%f",a);}'''
34
35 if math_dep.found() and glib_dep.found()
36 # test 3; code should link
37 code_links = valac.links(
38 code,
39 dependencies : [math_dep, glib_dep],
40 name: 'links with math & glib-2.0 library? == YES',
41 )
42 assert (code_links, 'Math library and glib-2.0 library should link successfully.')
43 endif
44
45 gio_dep = dependency('gio-2.0', required : false)
46
47 code = '''void main() {var s = new GLib.Settings ("test");}'''
48
49 if gio_dep.found()
50 # test 4; code should link
51 code_links = valac.links(
52 code,
53 dependencies : [gio_dep],
54 name: 'links with gio-2.0? == YES',
55 )
56 assert (code_links, 'gio-2.0 library should link successfully.')
57 endif
58
59 # test 5; code should not link
60 code_links = valac.links(
61 code,
62 name: 'links with gio-2.0? == NO',
63 )
64 assert (not code_links, 'gio-2.0 library should not link successfully.')