Skip to content

Commit 5b5b9a7

Browse files
committed
add e2e test data for sequence adaptation with multiple output languages
1 parent 4efb006 commit 5b5b9a7

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
'use strict';
2+
3+
/**
4+
* Minimal Sequence Adaptation for Testing
5+
*
6+
* This is a bare-bones adaptation useful for testing adaptation loading,
7+
* error handling, and the workspace console.
8+
*
9+
* To test different error scenarios, you can:
10+
* 1. Remove `exports.adaptation` - tests "No adaptation export found" error
11+
* 2. Set `exports.adaptation = null` - tests null adaptation error
12+
* 3. Remove `input` property - tests invalid adaptation structure
13+
* 4. Throw an error in toOutputFormat - tests runtime errors
14+
*/
15+
16+
// Minimal input language - no grammar, just basic structure
17+
const minimalInputLanguage = {
18+
fileExtension: '.seqN.txt',
19+
name: 'Minimal Test Input Language',
20+
getEditorExtension: (_context, resources) => [
21+
resources.linter(() => {
22+
// Pass the syntax node as undefined as it's optional in the implementation
23+
return [];
24+
}),
25+
],
26+
};
27+
28+
// Minimal output language 1
29+
const minimalOutputLanguage1 = {
30+
fileExtension: '.rml',
31+
name: 'Language 1 Output',
32+
getEditorExtension: (_context, resources) => {
33+
return [
34+
resources.linter(() => {
35+
// Pass the syntax node as undefined as it's optional in the implementation
36+
return [{
37+
from: 0,
38+
to: 10,
39+
severity: "warning",
40+
message: "This is a warning lint for output language 1"
41+
}];
42+
}),
43+
];
44+
},
45+
// Convert output back to input format
46+
toInputFormat: function () {
47+
return 'This is the converted input for language 1'
48+
},
49+
50+
// Convert input to output format
51+
toOutputFormat: function () {
52+
return 'This is the output for language 1'
53+
},
54+
};
55+
56+
// Minimal output language 2
57+
const minimalOutputLanguage2 = {
58+
fileExtension: '.vml',
59+
name: 'Language 2 Output',
60+
getEditorExtension: (_context, resources) => {
61+
return [
62+
resources.linter(() => {
63+
// Pass the syntax node as undefined as it's optional in the implementation
64+
return [{
65+
from: 0,
66+
to: 10,
67+
severity: "warning",
68+
message: "This is a warning lint for output language 2"
69+
}];
70+
}),
71+
];
72+
},
73+
74+
// Convert output back to input format
75+
toInputFormat: function () {
76+
return 'This is the converted input for language 2';
77+
},
78+
79+
// Convert input to output format
80+
toOutputFormat: function () {
81+
return 'This is the output for language 2'
82+
},
83+
};
84+
85+
// The main adaptation export
86+
const adaptation = {
87+
input: minimalInputLanguage,
88+
outputs: [minimalOutputLanguage1, minimalOutputLanguage2],
89+
};
90+
91+
// Export the adaptation (required)
92+
exports.adaptation = adaptation;

0 commit comments

Comments
 (0)