Pure OCaml Yaml 1.2 reader and writer using Bytesrw

cram

+13 -8
+1
tests/cram/bell_character.yml
··· 1 + text: "test\a"
+1
tests/cram/escaped_backslashes.yml
··· 1 + escaped: "one\\two\\three"
+7 -8
tests/cram/failing_escapes.t
··· 9 9 10 10 Test: Capital U interpreted as unicode escape 11 11 12 - $ echo 'path: "C:\\Users\\Name"' | yamlcat --json 2>&1 12 + $ yamlcat --json failing_escapes.yml 2>&1 13 13 Error: invalid hex escape: at line 1, columns 12-12 14 14 [1] 15 15 16 16 This fails because: 17 - - Shell: echo 'C:\\Users\\Name' produces C:\Users\Name 18 - - YAML sees: "C:\Users\Name" 17 + - YAML input: "C:\Users\Name" 19 18 - \U is a 32-bit unicode escape (expects \UHHHHHHHH) 20 19 - "sers" are not 8 hex digits, so it fails 21 20 22 21 Test: Lowercase u unicode escape works 23 22 24 - $ echo 'unicode: "\\u0041"' | yamlcat --json 23 + $ yamlcat --json lowercase_u_unicode.yml 25 24 {"unicode": "A"} 26 25 27 26 Test: Uppercase U requires 8 hex digits 28 27 29 - $ echo 'unicode: "\\U00000041"' | yamlcat --json 28 + $ yamlcat --json uppercase_U_unicode.yml 30 29 {"unicode": "A"} 31 30 32 31 Test: Backslash escaping works for non-unicode 33 32 34 - $ echo 'escaped: "one\\\\two\\\\three"' | yamlcat --json 33 + $ yamlcat --json escaped_backslashes.yml 35 34 {"escaped": "one\\two\\three"} 36 35 37 36 Test: Mixed valid escapes 38 37 39 - $ echo 'text: "Tab:\\t Newline:\\n Quote:\\\\"' | yamlcat --json 38 + $ yamlcat --json mixed_escapes.yml 40 39 {"text": "Tab:\t Newline:\n Quote:\\"} 41 40 42 41 Test: Backslash a is bell character 43 42 44 - $ echo 'text: "test\\a"' | yamlcat --json 43 + $ yamlcat --json bell_character.yml 45 44 {"text": "test\007"}
+1
tests/cram/failing_escapes.yml
··· 1 + path: "C:\Users\Name"
+1
tests/cram/lowercase_u_unicode.yml
··· 1 + unicode: "\u0041"
+1
tests/cram/mixed_escapes.yml
··· 1 + text: "Tab:\t Newline:\n Quote:\\"
+1
tests/cram/uppercase_U_unicode.yml
··· 1 + unicode: "\U00000041"