From 6f4e06f6b95320da1b4776f96e0b02899c07e8e7 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Fri, 23 Aug 2019 09:58:30 +0100 Subject: [PATCH] Annotation inappropriate for ExpectedPlaceholderMapping --- implementations/racket/preserves/main.rkt | 26 +- tests/samples.txt | 520 +++++++++++----------- 2 files changed, 273 insertions(+), 273 deletions(-) diff --git a/implementations/racket/preserves/main.rkt b/implementations/racket/preserves/main.rkt index c9534c8..2ddf552 100644 --- a/implementations/racket/preserves/main.rkt +++ b/implementations/racket/preserves/main.rkt @@ -992,20 +992,18 @@ (define-runtime-path tests-path "../../../tests") (let* ((path (build-path tests-path "samples.txt")) - (tests (call-with-input-file path - (lambda (p) - (port-count-lines! p) - (read-preserve-syntax p #:source path))))) - (local-require racket/pretty) - (define placeholder->value-map - (or (for/or [(a* (annotated-annotations tests))] - (match (strip-annotations a*) - [`#s(ExpectedPlaceholderMapping ,p->v) p->v] - [_ #f])) - (hash))) - (define value->placeholder-map - (for/hash [((k v) (in-hash placeholder->value-map))] - (values v k))) + (testfile (call-with-input-file path + (lambda (p) + (port-count-lines! p) + (read-preserve-syntax p #:source path))))) + (match-define (peel-annotations + `#s(TestCases + ,(strip-annotations + `#s(ExpectedPlaceholderMapping ,placeholder->value-map)) + ,tests)) + testfile) + (define value->placeholder-map (for/hash [((k v) (in-hash placeholder->value-map))] + (values v k))) (parameterize ((current-value->placeholder (lambda (v) (hash-ref value->placeholder-map v #f))) (current-placeholder->value (lambda (p) (hash-ref placeholder->value-map p void)))) diff --git a/tests/samples.txt b/tests/samples.txt index fa0de16..067eeaa 100644 --- a/tests/samples.txt +++ b/tests/samples.txt @@ -1,265 +1,267 @@ @ -@ -{ - annotation1: - annotation2: - annotation3: - annotation4: - annotation5: > - annotation6: > - bytes1: - bytes2: - bytes3: - bytes4: - bytes5: - bytes6: @"Bytes must be 2-digits entire" - bytes7: - bytes8: - bytes9: - bytes10: - bytes11: - bytes12: @"Bytes syntax only supports \\x, not \\u" - bytes13: + + { + annotation1: + annotation2: + annotation3: + annotation4: + annotation5: > + annotation6: > + bytes1: + bytes2: + 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" - 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: - list0: - list1: - list2: - list3: - list4: - list4a: - list5: - list6: - list7: - list8: @"Missing close bracket" - placeholder0: - placeholder1: - placeholder2: - record1: >> - record2: , >>>> - record3: "Dr">> - record4: > - record5: > - record6: > - record7: > - record8: 3 4>> - record9: @"Missing record label" "> - record10: @"Missing close-angle-bracket" - set0: - set1: - set1a: - set2: @"Missing close brace" - set2a: @"Missing close brace" - set3: @"Duplicate value" - stream1: @"Chunk must be bytes" - stream2: @"Chunk must be bytes" - stream3: @"Chunk must be bytes" - stream4: @"Chunk must be bytes" - stream5: @"Chunk must be bytes" - stream6: @"Chunk must be bytes" - stream7: @"Missing end byte" - stream8: @"Missing element" - string0: - string0a: - string1: - string2: - string3: - string4: - string5: - symbol0: - symbol1: - symbol2: - value1: - value2: - value3: - value4: - value5: - value6: + dict0: + dict1: + dict2: @"Missing close brace" + dict2a: @"Missing close brace" + dict3: @"Duplicate key" + 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: + list0: + list1: + list2: + list3: + list4: + list4a: + list5: + list6: + list7: + list8: @"Missing close bracket" + placeholder0: + placeholder1: + placeholder2: + record1: >> + record2: , >>>> + record3: "Dr">> + record4: > + record5: > + record6: > + record7: > + record8: 3 4>> + record9: @"Missing record label" "> + record10: @"Missing close-angle-bracket" + set0: + set1: + set1a: + set2: @"Missing close brace" + set2a: @"Missing close brace" + set3: @"Duplicate value" + stream1: @"Chunk must be bytes" + stream2: @"Chunk must be bytes" + stream3: @"Chunk must be bytes" + stream4: @"Chunk must be bytes" + stream5: @"Chunk must be bytes" + stream6: @"Chunk must be bytes" + stream7: @"Missing end byte" + stream8: @"Missing element" + string0: + string0a: + string1: + string2: + string3: + string4: + string5: + symbol0: + symbol1: + symbol2: + value1: + value2: + value3: + value4: + value5: + value6: - longlist14: - longlist15: - longlist100: - - longlist200: - + longlist14: + longlist15: + longlist100: + + longlist200: + - rfc8259-example1: + rfc8259-example1: - rfc8259-example2: + rfc8259-example2: -} + } +>