Skip to content

Commit

Permalink
adapt newlines for windows in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Jan 2, 2022
1 parent 72a0fa7 commit fdfee95
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
44 changes: 22 additions & 22 deletions test/fixtures/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,63 @@ const path = require('path')
module.exports = {
example: {
js: require('./example.json'),
xliff: fs.readFileSync(path.join(__dirname, 'example.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff_output_notes: fs.readFileSync(path.join(__dirname, 'example_output_note.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff_compact: fs.readFileSync(path.join(__dirname, 'example_compact.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12_output_notes: fs.readFileSync(path.join(__dirname, 'example12_output_note.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12_compact: fs.readFileSync(path.join(__dirname, 'example_compact12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff: fs.readFileSync(path.join(__dirname, 'example.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff_output_notes: fs.readFileSync(path.join(__dirname, 'example_output_note.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff_compact: fs.readFileSync(path.join(__dirname, 'example_compact.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12_output_notes: fs.readFileSync(path.join(__dirname, 'example12_output_note.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12_compact: fs.readFileSync(path.join(__dirname, 'example_compact12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
js_source: require('./example_source.json'),
js_target: require('./example_target.json'),
js_input_notes: require('./example_input_note.json'),
js_output_notes: require('./example_output_note.json')
},
example_source_attr: {
// The JS should be the same as example.js
xliff12: fs.readFileSync(path.join(__dirname, 'example_source_attr12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff12: fs.readFileSync(path.join(__dirname, 'example_source_attr12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_multi: {
js: require('./example_multi.json'),
xliff: fs.readFileSync(path.join(__dirname, 'example_multi.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_multi12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff: fs.readFileSync(path.join(__dirname, 'example_multi.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_multi12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
js_source: require('./example_multi_source.json'),
js_target: require('./example_multi_target.json')
},
example_note: {
js: require('./example_note.json'),
xliff: fs.readFileSync(path.join(__dirname, 'example_note.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_note12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_note.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_note12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_additional_attributes: {
js: require('./example_additional_attributes'),
xliff: fs.readFileSync(path.join(__dirname, 'example_additional_attributes.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_additional_attributes12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_additional_attributes.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_additional_attributes12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_angular: {
js: require('./example_angular'),
xliff: fs.readFileSync(path.join(__dirname, 'example_angular.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_angular12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_angular.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_angular12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_google: {
js: require('./example_google_action'),
xliff12: fs.readFileSync(path.join(__dirname, 'example_google_action.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff12: fs.readFileSync(path.join(__dirname, 'example_google_action.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_groups: {
js: require('./example_groups'),
xliff: fs.readFileSync(path.join(__dirname, 'example_groups.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_groups12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_groups.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_groups12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_cdata: {
js: require('./example_cdata'),
xliff: fs.readFileSync(path.join(__dirname, 'example_cdata.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_cdata12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_cdata.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_cdata12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_comments: {
js: require('./example_comments'),
xliff: fs.readFileSync(path.join(__dirname, 'example_comments.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_comments.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_ignorable: {
js: require('./example_ignorable'),
xliff: fs.readFileSync(path.join(__dirname, 'example_ignorable.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_ignorable.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
}
}
40 changes: 20 additions & 20 deletions test/fixtures/inline-elements/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,61 @@ const path = require('path')
module.exports = {
example_standalone: {
js: require('./example_standalone.json'),
xliff: fs.readFileSync(path.join(__dirname, 'example_standalone.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_standalone12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_standalone.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_standalone12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_standalone_only: {
js: require('./example_standalone_only.json'),
xliff: fs.readFileSync(path.join(__dirname, 'example_standalone_only.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_standalone_only12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_standalone_only.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_standalone_only12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_genericSpan: {
js: require('./example_generic-span.json'),
xliff: fs.readFileSync(path.join(__dirname, 'example_generic-span.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_generic-span12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff: fs.readFileSync(path.join(__dirname, 'example_generic-span.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_generic-span12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
js_source: require('./example_generic-span_source.json'),
js_target: require('./example_generic-span_target.json')
},
example_genericSpanStartEnd: {
js: require('./example_generic-span-start-end.json'),
xliff: fs.readFileSync(path.join(__dirname, 'example_generic-span-start-end.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_generic-span-start-end12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_generic-span-start-end.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_generic-span-start-end12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_nativeSpan: {
js: require('./example_native-span.json'),
xliff: fs.readFileSync(path.join(__dirname, 'example_native-span.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_native-span12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff: fs.readFileSync(path.join(__dirname, 'example_native-span.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_native-span12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
js_source: require('./example_native-span_source.json'),
js_target: require('./example_native-span_target.json')
},
example_nativeSpanStartEnd: {
js: require('./example_native-span-start-end.json'),
xliff: fs.readFileSync(path.join(__dirname, 'example_native-span-start-end.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_native-span-start-end12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_native-span-start-end.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_native-span-start-end12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_invalidSegment: {
js: require('./example_invalid-segment.json'),
xliff: fs.readFileSync(path.join(__dirname, 'example_invalid-segment.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_invalid-segment12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_invalid-segment.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_invalid-segment12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
// Examples showing how this could work with i18next
example_i18next_nativeSpan: {
js: require('./example_i18next_native-span.json'),
xliff12: fs.readFileSync(path.join(__dirname, 'example_i18next_native-span12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff12: fs.readFileSync(path.join(__dirname, 'example_i18next_native-span12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_i18next_unstructured_nativeSpan: {
js: require('./example_i18next_unstructured_native-span.json'),
xliff12: fs.readFileSync(path.join(__dirname, 'example_i18next_unstructured_native-span12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff12: fs.readFileSync(path.join(__dirname, 'example_i18next_unstructured_native-span12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
example_marker: {
js: require('./example_marker.json'),
xliff12: fs.readFileSync(path.join(__dirname, 'example_marker12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff12: fs.readFileSync(path.join(__dirname, 'example_marker12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
},
// angular
example_angular: {
js: require('./example_angular.json'),
xliff: fs.readFileSync(path.join(__dirname, 'example_angular.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_angular12.xliff')).toString().replace(/\n$/, '').replace(/\r$/, ''),
xliff12ident: fs.readFileSync(path.join(__dirname, 'example_angular12_ident.xliff')).toString().replace(/\n$/, '').replace(/\r$/, '')
xliff: fs.readFileSync(path.join(__dirname, 'example_angular.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12: fs.readFileSync(path.join(__dirname, 'example_angular12.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, ''),
xliff12ident: fs.readFileSync(path.join(__dirname, 'example_angular12_ident.xliff')).toString().replace(/(\r\n$|\r$|\n$)/, '')
}
}

0 comments on commit fdfee95

Please sign in to comment.