about summary refs log tree commit diff stats
path: root/awk/rawk/tests/simple_stdlib_test.rawk
diff options
context:
space:
mode:
Diffstat (limited to 'awk/rawk/tests/simple_stdlib_test.rawk')
-rw-r--r--awk/rawk/tests/simple_stdlib_test.rawk24
1 files changed, 24 insertions, 0 deletions
diff --git a/awk/rawk/tests/simple_stdlib_test.rawk b/awk/rawk/tests/simple_stdlib_test.rawk
new file mode 100644
index 0000000..0a726df
--- /dev/null
+++ b/awk/rawk/tests/simple_stdlib_test.rawk
@@ -0,0 +1,24 @@
+BEGIN {
+    print "=== Simple Standard Library Tests ==="
+}
+
+RAWK {
+    $test_function = (value) -> {
+        return is_number(value) && is_positive(value);
+    };
+}
+
+{
+    # Test basic type checking
+    expect_true(is_number(42), "42 should be a number");
+    expect_true(is_string("hello"), "hello should be a string");
+    expect_false(is_number("abc"), "abc should not be a number");
+    
+    # Test the custom function
+    expect_true(test_function(5), "5 should pass our test");
+    expect_false(test_function(-3), "-3 should fail our test");
+    expect_false(test_function("text"), "text should fail our test");
+    
+    print "All simple standard library tests passed!";
+    exit 0;
+} 
\ No newline at end of file