Bob/minimal_working.bob

26 lines
817 B
Plaintext

print("=== MINIMAL WORKING TEST ===");
// Test 1: Simple eval
print("Test 1: Simple eval");
var result1 = eval("print(\"Hello from eval\");");
print("Test 1 passed");
// Test 2: Eval with variable
print("Test 2: Eval with variable");
var result2 = eval("var x = 5; print(\"x = \" + toString(x));");
print("Test 2 passed");
// Test 3: Eval with function
print("Test 3: Eval with function");
var result3 = eval("func test() { return 42; } var y = test(); print(\"y = \" + toString(y));");
print("Test 3 passed");
// Test 4: Write simple code to file and eval
print("Test 4: File I/O with eval");
var simpleCode = "print(\"Hello from file\");";
writeFile("simple.bob", simpleCode);
var loadedCode = readFile("simple.bob");
var result4 = eval(loadedCode);
print("Test 4 passed");
print("All minimal tests passed!");