| 1 | module coracle |
| 2 | |
| 3 | import nspkg |
| 4 | import os |
| 5 | |
| 6 | fn 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 | |