From cb88c587b60791e5bbabe148d602ac4fed12854c Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Wed, 26 May 2021 21:11:45 +0200 Subject: [PATCH] Include a copy of samples.pr so that tests run OK on the buildserver --- git-hooks/pre-commit | 3 + .../preserves/preserves/tests/samples.pr | 319 ++++++++++++++++++ .../preserves/preserves/tests/test-main.rkt | 7 +- 3 files changed, 325 insertions(+), 4 deletions(-) create mode 100644 implementations/racket/preserves/preserves/tests/samples.pr diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index 804638a..0c6a4e5 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -4,3 +4,6 @@ exec 1>&2 # Ensure that various copies of schema.prs are in fact identical. cmp schema/schema.prs implementations/racket/preserves/preserves-schema/schema.prs + +# Likewise for samples.pr +cmp tests/samples.pr implementations/racket/preserves/preserves/tests/samples.pr diff --git a/implementations/racket/preserves/preserves/tests/samples.pr b/implementations/racket/preserves/preserves/tests/samples.pr new file mode 100644 index 0000000..c12396c --- /dev/null +++ b/implementations/racket/preserves/preserves/tests/samples.pr @@ -0,0 +1,319 @@ +@ +@ + "In each test, let value = strip(annotatedValue),", + " forward = value,", + " back = value," + "except where test-case-specific values of `forward` and/or `back`", + "are provided by the executing harness, and check the following" + "numbered expectations according to the table above:" + + "Implementations may vary in their treatment of the difference between expectations" + "13/14 and 16/17, depending on how they wish to treat end-of-stream conditions." +]> + + annotation2: + annotation3: + annotation4: + annotation5: > + annotation6: > + annotation7: + ;Stop reading symbols at @ -- this test has three separate annotations + + bytes2: + bytes2a: + bytes3: + bytes4: + bytes5: + bytes6: @"Bytes must be 2-digits entire" + bytes7: + bytes8: + bytes9: + bytes10: + bytes11: + bytes12: @"Bytes syntax only supports \\x, not \\u" + bytes13: + + dict0: + dict1: + dict2: @"Missing close brace" + dict2a: @"Missing close brace" + dict3: @"Duplicate key" + dict4: @"Unexpected close brace" + dict5: @"Missing value" + double1: + double2: + float1: + int-257: + int-256: + int-255: + int-254: + int-129: + int-128: + int-127: + int-4: + int-3: + int-2: + int-1: + int0: + int1: + int12: + int13: + int127: + int128: + int255: + int256: + int32767: + int32768: + int65535: + int65536: + int131072: + int2500000000: + list0: + list4: + list4a: + list5: + list6: + list7: + list8: @"Missing close bracket" + list9: @"Unexpected close bracket" + list10: @"Missing end byte" + noinput0: @"No input at all" + embed0: + embed1: + embed2: + record1: >> + record2: , >>>> + record3: "Dr">> + record4: > + record5: > + record6: > + record7: > + record8: 3 4>> + record9: @"Missing record label" "> + record10: @"Missing close-angle-bracket" + record11: @"Unexpected close-angle-bracket" "> + set0: + set1: + set2: @"Missing close brace" + set2a: @"Missing close brace" + set3: @"Duplicate value" + string0: + string3: + string4: + string5: + symbol0: + symbol2: + tag0: @"Unexpected end tag" + tag1: @"Invalid tag" + tag2: @"Invalid tag" + whitespace0: @"Leading spaces have to eventually yield something" + whitespace1: @"No input at all" + value1: + value2: + value3: + value4: + value5: + value6: + + longlist14: + longlist15: + longlist100: + + longlist200: + + + rfc8259-example1: + + rfc8259-example2: + +} +> diff --git a/implementations/racket/preserves/preserves/tests/test-main.rkt b/implementations/racket/preserves/preserves/tests/test-main.rkt index 31120b1..5f35914 100644 --- a/implementations/racket/preserves/preserves/tests/test-main.rkt +++ b/implementations/racket/preserves/preserves/tests/test-main.rkt @@ -173,15 +173,14 @@ binary-form loc))) -(define-runtime-path tests-path "../../../../../tests") -(let* ((path (build-path tests-path "samples.pr")) - (testfile (call-with-input-file path +(define-runtime-path samples-pr-path "./samples.pr") +(let* ((testfile (call-with-input-file samples-pr-path (lambda (p) (port-count-lines! p) (read-preserve p #:read-syntax? #t #:decode-embedded strip-annotations - #:source path))))) + #:source samples-pr-path))))) (match-define (peel-annotations `#s(TestCases ,tests)) testfile) (for [((t-name* t*) (in-hash (annotated-item tests)))] (define t-name (strip-annotations t-name*))