added a new test case using an exterally downloaded script
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -274,6 +274,7 @@ The `@pragma` keyword enables you to modify Hawk’s behavior. You can place a p
|
|||||||
| entry | global | function name | | change the program entry point |
|
| entry | global | function name | | change the program entry point |
|
||||||
| implicit | file | on, off | on | allow undeclared variables |
|
| implicit | file | on, off | on | allow undeclared variables |
|
||||||
| multilinestr | file | on, off | off | allow a multiline string literal without continuation |
|
| multilinestr | file | on, off | off | allow a multiline string literal without continuation |
|
||||||
|
| rwpipe | file | on, off | on | allow the two-way pipe operator `|&` |
|
||||||
| striprecspc | global | on, off | off | removes leading and trailing blank fields in splitting a record if FS is a regular expression mathcing all spaces |
|
| striprecspc | global | on, off | off | removes leading and trailing blank fields in splitting a record if FS is a regular expression mathcing all spaces |
|
||||||
| stripstrspc | global | on, off | on | trim leading and trailing spaces when converting a string to a number |
|
| stripstrspc | global | on, off | on | trim leading and trailing spaces when converting a string to a number |
|
||||||
| numstrdetect | global | on, off | on | trim leading and trailing spaces when converting a string to a number |
|
| numstrdetect | global | on, off | on | trim leading and trailing spaces when converting a string to a number |
|
||||||
|
28
t/JSON.awk.in
Normal file
28
t/JSON.awk.in
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"first_name": "John",
|
||||||
|
"last_name": "Smith",
|
||||||
|
"is_alive": true,
|
||||||
|
"age": 27,
|
||||||
|
"address": {
|
||||||
|
"street_address": "21 2nd Street",
|
||||||
|
"city": "New York",
|
||||||
|
"state": "NY",
|
||||||
|
"postal_code": "10021-3100"
|
||||||
|
},
|
||||||
|
"phone_numbers": [
|
||||||
|
{
|
||||||
|
"type": "home",
|
||||||
|
"number": "212 555-1234"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "office",
|
||||||
|
"number": "646 555-4567"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"children": [
|
||||||
|
"Catherine",
|
||||||
|
"Thomas",
|
||||||
|
"Trevor"
|
||||||
|
],
|
||||||
|
"spouse": null
|
||||||
|
}
|
16
t/JSON.awk.out
Normal file
16
t/JSON.awk.out
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
["first_name"] "John"
|
||||||
|
["last_name"] "Smith"
|
||||||
|
["is_alive"] true
|
||||||
|
["age"] 27
|
||||||
|
["address","street_address"] "21 2nd Street"
|
||||||
|
["address","city"] "New York"
|
||||||
|
["address","state"] "NY"
|
||||||
|
["address","postal_code"] "10021-3100"
|
||||||
|
["phone_numbers",0,"type"] "home"
|
||||||
|
["phone_numbers",0,"number"] "212 555-1234"
|
||||||
|
["phone_numbers",1,"type"] "office"
|
||||||
|
["phone_numbers",1,"number"] "646 555-4567"
|
||||||
|
["children",0] "Catherine"
|
||||||
|
["children",1] "Thomas"
|
||||||
|
["children",2] "Trevor"
|
||||||
|
["spouse"] null
|
@ -26,6 +26,7 @@ EXTRA_DIST = $(check_SCRIPTS) $(check_ERRORS) tap.inc err.sh \
|
|||||||
journal-toc.hawk journal-toc.in journal-toc.out journal-toc-html.out \
|
journal-toc.hawk journal-toc.in journal-toc.out journal-toc-html.out \
|
||||||
bibtex-to-html.hawk bibtex-to-html.out \
|
bibtex-to-html.hawk bibtex-to-html.out \
|
||||||
fs-test.hawk fs-test.in fs-test.out \
|
fs-test.hawk fs-test.in fs-test.out \
|
||||||
|
JSON.awk.in JSON.awk.out \
|
||||||
two-way-pipe.hawk two-way-pipe.out
|
two-way-pipe.hawk two-way-pipe.out
|
||||||
|
|
||||||
check_PROGRAMS = t-001 t-002 t-003 t-004 t-005 t-006 t-007 t-008 t-009
|
check_PROGRAMS = t-001 t-002 t-003 t-004 t-005 t-006 t-007 t-008 t-009
|
||||||
|
@ -650,6 +650,7 @@ EXTRA_DIST = $(check_SCRIPTS) $(check_ERRORS) tap.inc err.sh \
|
|||||||
journal-toc.hawk journal-toc.in journal-toc.out journal-toc-html.out \
|
journal-toc.hawk journal-toc.in journal-toc.out journal-toc-html.out \
|
||||||
bibtex-to-html.hawk bibtex-to-html.out \
|
bibtex-to-html.hawk bibtex-to-html.out \
|
||||||
fs-test.hawk fs-test.in fs-test.out \
|
fs-test.hawk fs-test.in fs-test.out \
|
||||||
|
JSON.awk.in JSON.awk.out \
|
||||||
two-way-pipe.hawk two-way-pipe.out
|
two-way-pipe.hawk two-way-pipe.out
|
||||||
|
|
||||||
t_001_SOURCES = t-001.c tap.h
|
t_001_SOURCES = t-001.c tap.h
|
||||||
|
12
t/h-003.hawk
12
t/h-003.hawk
@ -75,6 +75,17 @@ function run_test (x, more_opts, in_name, set_out_name, out_name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function run_github_step_JSON_awk() {
|
||||||
|
@local url, tgt, tgt_hawk;
|
||||||
|
url = "https://raw.githubusercontent.com/step-/JSON.awk/refs/heads/master/JSON.awk";
|
||||||
|
tgt = sprintf("%s.%d", "JSON.awk", sys::getpid());
|
||||||
|
tgt_hawk = sprintf("%s/%s.hawk", TDIR, tgt);
|
||||||
|
|
||||||
|
system(sprintf("curl -k -o %s %s", tgt_hawk, url));
|
||||||
|
run_test(tgt, "", "JSON.awk", 0, "JSON.awk");
|
||||||
|
sys::unlink(tgt_hawk);
|
||||||
|
}
|
||||||
|
|
||||||
function main()
|
function main()
|
||||||
{
|
{
|
||||||
run_test("journal-toc", "", @nil, 0, @nil);
|
run_test("journal-toc", "", @nil, 0, @nil);
|
||||||
@ -83,6 +94,7 @@ function main()
|
|||||||
run_test("fs-test", "", "fs-test", 0, "fs-test");
|
run_test("fs-test", "", "fs-test", 0, "fs-test");
|
||||||
run_test("two-way-pipe", "", @nil, 0, "two-way-pipe");
|
run_test("two-way-pipe", "", @nil, 0, "two-way-pipe");
|
||||||
|
|
||||||
|
run_github_step_JSON_awk();
|
||||||
tap_end();
|
tap_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user