1{ 2 "$schema": "https://raw.githubusercontent.com/unicode-org/message-format-wg/main/test/schemas/v0/tests.schema.json", 3 "scenario": "Data model errors", 4 "defaultTestProperties": { 5 "locale": "en-US" 6 }, 7 "tests": [ 8 { 9 "src": ".input {$foo :x} .match $foo * * {{foo}}", 10 "expErrors": [ 11 { 12 "type": "variant-key-mismatch" 13 } 14 ] 15 }, 16 { 17 "src": ".input {$foo :x} .input {$bar :x} .match $foo $bar * {{foo}}", 18 "expErrors": [ 19 { 20 "type": "variant-key-mismatch" 21 } 22 ] 23 }, 24 { 25 "src": ".input {$foo :x} .match $foo 1 {{_}}", 26 "expErrors": [ 27 { 28 "type": "missing-fallback-variant" 29 } 30 ] 31 }, 32 { 33 "src": ".input {$foo :x} .match $foo other {{_}}", 34 "expErrors": [ 35 { 36 "type": "missing-fallback-variant" 37 } 38 ] 39 }, 40 { 41 "src": ".input {$foo :x} .input {$bar :x} .match $foo $bar * 1 {{_}} 1 * {{_}}", 42 "expErrors": [ 43 { 44 "type": "missing-fallback-variant" 45 } 46 ] 47 }, 48 { 49 "src": ".input {$foo} .match $foo one {{one}} * {{other}}", 50 "expErrors": [ 51 { 52 "type": "missing-selector-annotation" 53 } 54 ] 55 }, 56 { 57 "src": ".local $foo = {$bar} .match $foo one {{one}} * {{other}}", 58 "expErrors": [ 59 { 60 "type": "missing-selector-annotation" 61 } 62 ] 63 }, 64 { 65 "src": ".input {$bar} .local $foo = {$bar} .match $foo one {{one}} * {{other}}", 66 "expErrors": [ 67 { 68 "type": "missing-selector-annotation" 69 } 70 ] 71 }, 72 { 73 "src": ".input {$foo} .input {$foo} {{_}}", 74 "expErrors": [ 75 { 76 "type": "duplicate-declaration" 77 } 78 ] 79 }, 80 { 81 "src": ".input {$foo} .local $foo = {42} {{_}}", 82 "expErrors": [ 83 { 84 "type": "duplicate-declaration" 85 } 86 ] 87 }, 88 { 89 "src": ".local $foo = {42} .input {$foo} {{_}}", 90 "expErrors": [ 91 { 92 "type": "duplicate-declaration" 93 } 94 ] 95 }, 96 { 97 "src": ".local $foo = {:unknown} .local $foo = {42} {{_}}", 98 "expErrors": [ 99 { 100 "type": "duplicate-declaration" 101 } 102 ] 103 }, 104 { 105 "src": ".local $foo = {$bar} .local $bar = {42} {{_}}", 106 "expErrors": [ 107 { 108 "type": "duplicate-declaration" 109 } 110 ] 111 }, 112 { 113 "src": ".local $foo = {$foo} {{_}}", 114 "expErrors": [ 115 { 116 "type": "duplicate-declaration" 117 } 118 ] 119 }, 120 { 121 "src": ".local $foo = {$bar} .local $bar = {$baz} {{_}}", 122 "expErrors": [ 123 { 124 "type": "duplicate-declaration" 125 } 126 ] 127 }, 128 { 129 "src": ".local $foo = {$bar :func} .local $bar = {$baz} {{_}}", 130 "expErrors": [ 131 { 132 "type": "duplicate-declaration" 133 } 134 ] 135 }, 136 { 137 "src": ".local $foo = {42 :func opt=$foo} {{_}}", 138 "expErrors": [ 139 { 140 "type": "duplicate-declaration" 141 } 142 ] 143 }, 144 { 145 "src": ".local $foo = {42 :func opt=$bar} .local $bar = {42} {{_}}", 146 "expErrors": [ 147 { 148 "type": "duplicate-declaration" 149 } 150 ] 151 }, 152 { 153 "src": "bad {:placeholder option=x option=x}", 154 "expErrors": [ 155 { 156 "type": "duplicate-option-name" 157 } 158 ] 159 }, 160 { 161 "src": "bad {:placeholder ns:option=x ns:option=y}", 162 "expErrors": [ 163 { 164 "type": "duplicate-option-name" 165 } 166 ] 167 }, 168 { 169 "src": ".input {$var :string} .match $var * {{The first default}} * {{The second default}}", 170 "expErrors": [ 171 { 172 "type": "duplicate-variant" 173 } 174 ] 175 }, 176 { 177 "src": ".input {$x :string} .input {$y :string} .match $x $y * foo {{The first foo variant}} bar * {{The bar variant}} * |foo| {{The second foo variant}} * * {{The default variant}}", 178 "expErrors": [ 179 { 180 "type": "duplicate-variant" 181 } 182 ] 183 }, 184 { 185 "src": ".local $star = {star :string} .match $star |*| {{Literal star}} * {{The default}}", 186 "exp": "The default" 187 } 188 ] 189} 190