Skip to main content

meta_language/
language_fixtures.rs

1//! Executable language-target fixtures, extracted from `parity` to keep
2//! `src/parity.rs` under the repository file-size limit.
3
4use crate::parity::LanguageFixture;
5
6/// Executable fixtures for every language target requested by the founding issue.
7pub const LANGUAGE_FIXTURES: &[LanguageFixture] = &[
8    LanguageFixture {
9        language: "txt",
10        source: "Plain text region\ncafe au lait\nUTF-8 line: café\n",
11        description: "Plain-text UTF-8 prose with trailing newline",
12    },
13    LanguageFixture {
14        language: "Markdown",
15        source: "# Title\n\n```rust\nfn main() {}\n```\n",
16        description: "Markdown document with embedded fenced code",
17    },
18    LanguageFixture {
19        language: "HTML",
20        source: "<script>const x = 1;</script><style>.x { color: red; }</style><p style=\"color: blue\">text</p>\n",
21        description: "HTML document with script, style, and style-attribute regions",
22    },
23    LanguageFixture {
24        language: "PDF",
25        source: "%PDF-1.7\n1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n2 0 obj\n<< /Type /Pages /Kids [3 0 R] /Count 1 >>\nendobj\n3 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Resources << /Font << /F1 4 0 R /F2 5 0 R /F3 6 0 R >> >> /Contents 7 0 R >>\nendobj\n4 0 obj\n<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>\nendobj\n5 0 obj\n<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold >>\nendobj\n6 0 obj\n<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Oblique >>\nendobj\n7 0 obj\n<< /Length 163 >>\nstream\n/H1 BDC\nBT\n72 720 Td\n/F1 24 Tf\n(Status Report) Tj\nET\nEMC\n/P BDC\nBT\n72 698 Td\n/F1 12 Tf\n(The system is ) Tj\n/F2 12 Tf\n(ready) Tj\n/F1 12 Tf\n( for launch.) Tj\nET\nEMC\nendstream\nendobj\nxref\n0 8\n0000000000 65535 f \n0000000009 00000 n \n0000000058 00000 n \n0000000115 00000 n \n0000000261 00000 n \n0000000331 00000 n \n0000000406 00000 n \n0000000484 00000 n \ntrailer\n<< /Size 8 /Root 1 0 R >>\nstartxref\n697\n%%EOF\n",
26        description: "Text PDF profile with bold + heading + paragraph (issue #84)",
27    },
28    LanguageFixture {
29        language: "DOCX",
30        source: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<w:document xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"><w:body><w:p><w:pPr><w:pStyle w:val=\"Heading1\"/></w:pPr><w:r><w:t xml:space=\"preserve\">Status Report</w:t></w:r></w:p><w:p><w:r><w:t xml:space=\"preserve\">The system is </w:t></w:r><w:r><w:rPr><w:b/></w:rPr><w:t xml:space=\"preserve\">ready</w:t></w:r><w:r><w:t xml:space=\"preserve\"> for launch.</w:t></w:r></w:p><w:p><w:pPr><w:numPr><w:ilvl w:val=\"0\"/><w:numId w:val=\"1\"/></w:numPr></w:pPr><w:r><w:t xml:space=\"preserve\">First item</w:t></w:r></w:p><w:p><w:pPr><w:numPr><w:ilvl w:val=\"0\"/><w:numId w:val=\"1\"/></w:numPr></w:pPr><w:r><w:t xml:space=\"preserve\">Second </w:t></w:r><w:r><w:rPr><w:b/></w:rPr><w:t xml:space=\"preserve\">strong</w:t></w:r><w:r><w:t xml:space=\"preserve\"> item</w:t></w:r></w:p><w:sectPr/></w:body></w:document>\n",
31        description: "OOXML document.xml profile with heading + bold + bullet list (issue #85)",
32    },
33    LanguageFixture {
34        language: "Python",
35        source: "def f(x):\n    return x + 1\n",
36        description: "Python function with indentation",
37    },
38    LanguageFixture {
39        language: "C",
40        source: "int main(void) { return 0; }\n",
41        description: "C entry point",
42    },
43    LanguageFixture {
44        language: "Java",
45        source: "class Main { public static void main(String[] args) {} }\n",
46        description: "Java class entry point",
47    },
48    LanguageFixture {
49        language: "C++",
50        source: "int main() { return 0; }\n",
51        description: "C++ entry point",
52    },
53    LanguageFixture {
54        language: "C#",
55        source: "class C { static void Main() {} }\n",
56        description: "C# class entry point",
57    },
58    LanguageFixture {
59        language: "JavaScript",
60        source: "const value = 1;\n",
61        description: "JavaScript binding",
62    },
63    LanguageFixture {
64        language: "Visual Basic",
65        source: "Module Program\nEnd Module\n",
66        description: "Visual Basic module",
67    },
68    LanguageFixture {
69        language: "R",
70        source: "value <- 1\n",
71        description: "R assignment",
72    },
73    LanguageFixture {
74        language: "sql-ansi",
75        source: "SELECT id, name FROM users WHERE active = TRUE;\n",
76        description: "ANSI SQL select statement",
77    },
78    LanguageFixture {
79        language: "Delphi/Object Pascal",
80        source: "unit DemoUnit;\n\ninterface\n\ntype\n  TBox<T> = class\n  private\n    FValue: T;\n  public\n    [Stored]\n    property Value: T read FValue write FValue;\n  end;\n\nimplementation\n\nend.\n",
81        description: "Delphi/Object Pascal unit with a generic class property",
82    },
83    LanguageFixture {
84        language: "English",
85        source: "Hawaii is a state.\n",
86        description: "English formalization sentence",
87    },
88    LanguageFixture {
89        language: "Mandarin Chinese",
90        source: "你好。\n",
91        description: "Mandarin Chinese sentence",
92    },
93    LanguageFixture {
94        language: "Hindi",
95        source: "नमस्ते।\n",
96        description: "Hindi sentence",
97    },
98    LanguageFixture {
99        language: "Spanish",
100        source: "Hawaii es un estado.\n",
101        description: "Spanish reconstruction sentence",
102    },
103    LanguageFixture {
104        language: "French",
105        source: "Hawaii est un etat.\n",
106        description: "French reconstruction sentence",
107    },
108    LanguageFixture {
109        language: "Modern Standard Arabic",
110        source: "مرحبا.\n",
111        description: "Modern Standard Arabic sentence",
112    },
113    LanguageFixture {
114        language: "Bengali",
115        source: "নমস্কার।\n",
116        description: "Bengali sentence",
117    },
118    LanguageFixture {
119        language: "Russian",
120        source: "Гавайи это штат.\n",
121        description: "Russian reconstruction sentence",
122    },
123    LanguageFixture {
124        language: "Portuguese",
125        source: "Hawaii e um estado.\n",
126        description: "Portuguese reconstruction sentence",
127    },
128    LanguageFixture {
129        language: "Urdu",
130        source: "سلام۔\n",
131        description: "Urdu sentence",
132    },
133    LanguageFixture {
134        language: "JSON",
135        source: "{\n  \"name\": \"café\",\n  \"items\": [1, 2, 3]\n}\n",
136        description: "JSON object with UTF-8 string and array",
137    },
138    LanguageFixture {
139        language: "YAML",
140        source: "name: café\nitems:\n  - 1\n  - 2\n",
141        description: "YAML mapping with UTF-8 value and sequence",
142    },
143    LanguageFixture {
144        language: "TOML",
145        source: "title = \"café\"\n\n[owner]\nname = \"Tom\"\n",
146        description: "TOML document with a UTF-8 value and a table",
147    },
148    LanguageFixture {
149        language: "XML",
150        source: "<note lang=\"en\">\n  <body>café</body>\n</note>\n",
151        description: "XML element tree with attribute and UTF-8 text",
152    },
153    LanguageFixture {
154        language: "INI",
155        source: "; comment\n[owner]\nname = café\n",
156        description: "INI section with a comment and a UTF-8 value",
157    },
158    LanguageFixture {
159        language: "protobuf",
160        source: "syntax = \"proto3\";\n\nmessage Person {\n  string name = 1;\n}\n",
161        description: "Protocol Buffers message definition",
162    },
163    LanguageFixture {
164        language: "GraphQL",
165        source: "type Person {\n  name: String!\n}\n",
166        description: "GraphQL schema-definition type",
167    },
168    LanguageFixture {
169        language: "CSV",
170        source: "name,city\n\"Ana, Maria\",Lisbon\nBao,北京\n",
171        description: "CSV records with a quoted comma and UTF-8 field",
172    },
173    LanguageFixture {
174        language: "JSON5",
175        source: "{\n  // JSON5 accepts comments and unquoted keys\n  name: 'café',\n  items: [1, 2, 3,],\n}\n",
176        description: "JSON5 object with comments, unquoted keys, single quotes, and trailing commas",
177    },
178    LanguageFixture {
179        language: "PHP",
180        source: "<?php\nfunction greet($name) {\n    return \"café \" . $name;\n}\n",
181        description: "PHP function returning a UTF-8 string",
182    },
183    LanguageFixture {
184        language: "Swift",
185        source: "func greet(_ name: String) -> String {\n    return \"café \\(name)\"\n}\n",
186        description: "Swift function with a UTF-8 interpolated string",
187    },
188    LanguageFixture {
189        language: "Kotlin",
190        source: "fun greet(name: String): String {\n    return \"café $name\"\n}\n",
191        description: "Kotlin function with a UTF-8 template string",
192    },
193    LanguageFixture {
194        language: "Scala",
195        source: "object Demo {\n  def greet(name: String): String = s\"café $name\"\n}\n",
196        description: "Scala object with a UTF-8 interpolated method",
197    },
198    LanguageFixture {
199        language: "Lua",
200        source: "local function greet(name)\n  return \"café \" .. name\nend\n",
201        description: "Lua function concatenating a UTF-8 string",
202    },
203    LanguageFixture {
204        language: "Perl",
205        source: "use utf8;\nsub greet {\n    my ($name) = @_;\n    return \"café $name\";\n}\n",
206        description: "Perl subroutine returning a UTF-8 interpolated string",
207    },
208];