57 lines
2.1 KiB
Plaintext
57 lines
2.1 KiB
Plaintext
// Build system audit tests
|
|
// Tests deterministic dylib paths, symbol naming, and lib layout
|
|
|
|
var shop = use('internal/shop')
|
|
var runtime = use('runtime')
|
|
|
|
return {
|
|
// ========================================================================
|
|
// 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
|
|
}
|
|
}
|