nspkg / tests / coracle / coexistence_test.v
24 lines · 22 sloc · 1.0 KB · c01b0795d1db56c7bce2539b2c46b110637fdc1a
Raw
1module coracle
2
3import nspkg
4import os
5
6fn test_public_facade_and_frozen_c_oracle_have_independent_handles() ! {
7 base := os.join_path(os.vtmp_dir(), 'alpm-facade-oracle-${os.getpid()}')
8 os.mkdir_all(os.join_path(base, 'public'))!
9 os.mkdir_all(os.join_path(base, 'reference'))!
10 defer { os.rmdir_all(base) or { eprintln(err) } }
11 public := nspkg.initialize('/', os.join_path(base, 'public'))!
12 defer { public.release() or { eprintln(err) } }
13 reference := initialize('/', os.join_path(base, 'reference'))!
14 defer { reference.release() or { eprintln(err) } }
15 assert voidptr(public) != voidptr(reference)
16 public.option_add_ignore_pkg('public-only')!
17 reference.option_add_ignore_pkg('reference-only')!
18 mut public_items := public.option_get_ignore_pkgs()
19 mut reference_items := reference.option_get_ignore_pkgs()
20 assert public_items.strs() == ['public-only']
21 assert reference_items.strs() == ['reference-only']
22 assert public.get_localdb()!.get_pkgcache() == none
23 assert reference.get_localdb()!.get_pkgcache() == none
24}
25