diff options
Diffstat (limited to 'awk/rawk/tests/test_smart_stdlib.rawk')
-rw-r--r-- | awk/rawk/tests/test_smart_stdlib.rawk | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/awk/rawk/tests/test_smart_stdlib.rawk b/awk/rawk/tests/test_smart_stdlib.rawk new file mode 100644 index 0000000..5c3d9fe --- /dev/null +++ b/awk/rawk/tests/test_smart_stdlib.rawk @@ -0,0 +1,28 @@ +BEGIN { + print "=== Smart Standard Library Test ===" + print "This test uses only a few standard library functions" + print "to demonstrate smart inclusion" +} + +RAWK { + $validate_email = (email) -> { + return is_email(email); + }; + + $check_number = (num) -> { + return is_number(num); + }; +} + +{ + # Only use is_email and is_number from standard library + expect_true(validate_email("test@example.com"), "Valid email should pass"); + expect_false(validate_email("invalid"), "Invalid email should fail"); + + expect_true(check_number(42), "Number should pass"); + expect_false(check_number("abc"), "String should fail"); + + print "Smart standard library test passed!"; + print "Only is_email and is_number should be included in output"; + exit 0; +} \ No newline at end of file |