Files
hakorune/apps/smokes/std/string_smoke.nyash
Tomoaki 7d88c04c0e wip(phase15): AOT修正作業中 - Nyプラグインと標準ライブラリ実装
Phase 15のAOT/ネイティブビルド修正作業を継続中。
ChatGPTによるstd実装とプラグインシステムの改修を含む。

主な変更点:
- apps/std/: string.nyashとarray.nyashの標準ライブラリ追加
- apps/smokes/: stdライブラリのスモークテスト追加
- プラグインローダーv2の実装改修
- BoxCallのハンドル管理改善
- JIT hostcall registryの更新
- ビルドスクリプト(build_aot.sh, build_llvm.sh)の調整

まだ修正作業中のため、一部の機能は不完全な状態。

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-06 06:24:08 +09:00

39 lines
1.1 KiB
Plaintext

// std.string smoke: length/concat/slice/index_of/equals
static box Main {
main() {
local S
S = include "apps/std/string.nyash"
local fails
fails = 0
// length
if S.string_length("abc") != 3 { fails = fails + 1 }
if S.string_length("") != 0 { fails = fails + 1 }
// concat
if S.string_concat("a", "b") != "ab" { fails = fails + 1 }
if S.string_concat("", "x") != "x" { fails = fails + 1 }
// slice (clamp + basic)
if S.string_slice("hello", 1, 4) != "ell" { fails = fails + 1 }
if S.string_slice("hi", -5, 5) != "hi" { fails = fails + 1 }
if S.string_slice("x", 0, 0) != "" { fails = fails + 1 }
// index_of
if S.string_index_of("banana", "na") != 2 { fails = fails + 1 }
if S.string_index_of("banana", "zz") != -1 { fails = fails + 1 }
if S.string_index_of("abc", "") != 0 { fails = fails + 1 }
// equals
if S.string_equals("a", "a") != 1 { fails = fails + 1 }
if S.string_equals("a", "b") != 0 { fails = fails + 1 }
if fails == 0 {
print("OK: string")
return 0
}
print("FAIL: string (" + fails.toString() + ")")
return 1
}
}