forked from syndicate-lang/preserves
Annotation inappropriate for ExpectedPlaceholderMapping
This commit is contained in:
parent
a7147fa123
commit
6f4e06f6b9
|
@ -992,19 +992,17 @@
|
|||
|
||||
(define-runtime-path tests-path "../../../tests")
|
||||
(let* ((path (build-path tests-path "samples.txt"))
|
||||
(tests (call-with-input-file path
|
||||
(testfile (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))]
|
||||
(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)))
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
@<EmacsMode "-*- preserves -*-">
|
||||
@<ExpectedPlaceholderMapping {
|
||||
<TestCases
|
||||
<ExpectedPlaceholderMapping {
|
||||
0: discard
|
||||
1: capture
|
||||
2: observe
|
||||
}>
|
||||
{
|
||||
}>
|
||||
{
|
||||
annotation1: <Test #hex{055361626339} @"abc" 9>
|
||||
annotation2: <Test #hex{05536162630553646566929005517890} @"abc" @"def" [[] @"x" []]>
|
||||
annotation3: <Test #hex{050531320505333435} @@1 2 @@3 4 5>
|
||||
|
@ -207,7 +208,7 @@
|
|||
42 03af
|
||||
42 00ea
|
||||
43 009789}
|
||||
{
|
||||
{
|
||||
"Image": {
|
||||
"Width": 800,
|
||||
"Height": 600,
|
||||
|
@ -220,7 +221,7 @@
|
|||
"Animated" : false,
|
||||
"IDs": [116, 943, 234, 38793]
|
||||
}
|
||||
}>
|
||||
}>
|
||||
|
||||
rfc8259-example2: <NondeterministicTest
|
||||
#hex{92 bf10 58 4c61746974756465 03 4042e226809d4952
|
||||
|
@ -239,7 +240,7 @@
|
|||
55 5374617465 52 4341
|
||||
53 5a6970 55 3934303835
|
||||
54 43697479 59 53554e4e5956414c45}
|
||||
[
|
||||
[
|
||||
{
|
||||
"precision": "zip",
|
||||
"Latitude": 37.7668,
|
||||
|
@ -260,6 +261,7 @@
|
|||
"Zip": "94085",
|
||||
"Country": "US"
|
||||
}
|
||||
]>
|
||||
]>
|
||||
|
||||
}
|
||||
}
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue