// Build system audit tests // Tests deterministic dylib paths, symbol naming, and lib layout var shop = use('internal/shop') var runtime = use('runtime') return { // ======================================================================== // DETERMINISTIC DYLIB PATHS // ======================================================================== test_dylib_path_deterministic: function() { var path = shop.get_dylib_path('core', 'time') if (!ends_with(path, '/lib/core/time.dylib')) return "dylib path should end with /lib/core/time.dylib, got: " + path }, test_dylib_path_internal: function() { var path = shop.get_dylib_path('core', 'internal/os') if (!ends_with(path, '/lib/core/internal/os.dylib')) return "dylib path should end with /lib/core/internal/os.dylib, got: " + path }, test_dylib_path_external_package: function() { var path = shop.get_dylib_path('gitea.pockle.world/john/prosperon', 'sprite') if (!ends_with(path, '/lib/gitea.pockle.world/john/prosperon/sprite.dylib')) return "dylib path should mirror package layout, got: " + path }, // ======================================================================== // SYMBOL NAMING // ======================================================================== test_c_symbol_module: function() { var sym = shop.c_symbol_for_file('pkg', 'sprite.c') if (sym != 'js_pkg_sprite_use') return "expected js_pkg_sprite_use, got: " + sym }, test_c_symbol_program: function() { var sym = shop.c_symbol_for_file('pkg', 'game.ce') if (sym != 'js_pkg_game_program') return "expected js_pkg_game_program, got: " + sym }, test_c_symbol_internal: function() { var sym = shop.c_symbol_for_file('pkg', 'internal/os.c') if (sym != 'js_pkg_internal_os_use') return "expected js_pkg_internal_os_use, got: " + sym }, test_c_symbol_dotted_package: function() { var sym = shop.c_symbol_for_file('gitea.pockle.world/john/prosperon', 'sprite.c') if (sym != 'js_gitea_pockle_world_john_prosperon_sprite_use') return "expected js_gitea_pockle_world_john_prosperon_sprite_use, got: " + sym }, // ======================================================================== // LIB NAME // ======================================================================== test_lib_name: function() { var name = shop.lib_name_for_package('gitea.pockle.world/john/prosperon') if (name != 'gitea_pockle_world_john_prosperon') return "expected gitea_pockle_world_john_prosperon, got: " + name }, test_lib_name_simple: function() { var name = shop.lib_name_for_package('core') if (name != 'core') return "expected core, got: " + name }, // ======================================================================== // SYMBOL PREFIX // ======================================================================== test_c_symbol_prefix: function() { var prefix = shop.c_symbol_prefix('mypackage') if (prefix != 'js_mypackage_') return "expected js_mypackage_, got: " + prefix } }