# ============================================
# BUILTINS COVERAGE TEST: Core (0-7)
# Tests: help, call, clear, echo, print, http_get, Some, None
# ============================================
print("=== TESTING CORE BUILTINS (0-7) ===\n")
# --------------------------------------------
# 0. help - Display help information
# --------------------------------------------
print("0. Testing help()...")
help_output = help()
match type_of(help_output) {
"String" => print(" ✓ help() returns string"),
_ => print(" ✗ FAILED: help() type")
}
# --------------------------------------------
# 1. call - Dynamic function call
# --------------------------------------------
print("\n1. Testing call()...")
call_result = call("len", [1, 2, 3])
match call_result {
3 => print(" ✓ call('len', [1,2,3]) = 3"),
_ => print(" ✗ FAILED: call result")
}
# --------------------------------------------
# 2. clear - Clear screen (side effect, just verify callable)
# --------------------------------------------
print("\n2. Testing clear()...")
# clear() # Commented out to avoid clearing test output
print(" ✓ clear() is callable (skipped to preserve output)")
# --------------------------------------------
# 3. echo - Echo value
# --------------------------------------------
print("\n3. Testing echo()...")
echo_result = echo("hello world")
match type_of(echo_result) {
"String" => print(" ✓ echo() returns string"),
_ => print(" ✗ FAILED: echo() type")
}
# --------------------------------------------
# 4. print - Print value
# --------------------------------------------
print("\n4. Testing print()...")
print_result = print("test message")
match type_of(print_result) {
"String" => print(" ✓ print() returns string"),
_ => print(" ✗ FAILED: print() type")
}
# Test print with different types
print(" Testing print with Int: ${print(42)}")
print(" Testing print with Array: ${print([1,2])}")
print(" Testing print with Record: ${print({a: 1})}")
# --------------------------------------------
# 5. http_get - HTTP GET request
# --------------------------------------------
print("\n5. Testing http_get()...")
# Note: http_get requires network, test with type check
print(" ⚠ http_get() skipped (requires network)")
# --------------------------------------------
# 6. Some - Option wrapper
# --------------------------------------------
print("\n6. Testing Some()...")
some_val = Some(42)
match type_of(some_val) {
"Record" => print(" ✓ Some(42) creates Record"),
_ => print(" ✗ FAILED: Some() type")
}
# Test Some with different types
some_str = Some("hello")
some_arr = Some([1,2,3])
print(" ✓ Some with string: ${some_str}")
print(" ✓ Some with array: ${some_arr}")
# --------------------------------------------
# 7. None - Empty option
# --------------------------------------------
print("\n7. Testing None()...")
none_val = None()
match type_of(none_val) {
"Record" => print(" ✓ None() creates Record"),
_ => print(" ✗ FAILED: None() type")
}
print("\n=== CORE BUILTINS TESTS COMPLETE ===")