-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
other.js
147 lines (128 loc) · 4.79 KB
/
other.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*!
* strip-comments <https://github.com/jonschlinkert/strip-comments>
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT license.
*/
'use strict';
const fs = require('fs');
const path = require('path');
const assert = require('assert');
const strip = require('../index');
const fixture = path.join.bind(path, __dirname, 'fixtures/other');
const expected = path.join.bind(path, __dirname, 'expected/other');
const read = src => fs.readFileSync(src, 'utf-8').replace(/\r*\n/g, '\n');;
describe('other languages', () => {
it('should strip Ada comments', () => {
const name = 'ada';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name, preserveNewlines: true });
assert.strictEqual(actual, output);
});
it('should strip APL comments', () => {
const name = 'apl';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name, preserveNewlines: true });
assert.strictEqual(actual, output);
});
it('should strip C comments', () => {
const name = 'c';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name, preserveNewlines: true });
assert.strictEqual(actual, output);
});
it('should strip AppleScript comments', () => {
const name = 'AppleScript';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
it('should strip Haskell comments', () => {
const name = 'haskell';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
it('should strip Lua comments', () => {
const name = 'lua';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
it('should strip MATLAB comments', () => {
const name = 'matlab';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
it('should strip OCaml comments', () => {
const name = 'ocaml';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
it('should strip Pascal comments', () => {
const name = 'pascal';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
it('should strip PHP comments', () => {
const name = 'php';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
it('should strip Perl comments', () => {
const name = 'perl';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
it('should strip Python comments', () => {
const name = 'python';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
it('should strip Ruby comments', () => {
const name = 'ruby';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
it('should strip shebang comments', () => {
const name = 'shebang';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
it('should strip SQL comments', () => {
const name = 'sql';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
it('should strip Swift comments', () => {
const name = 'swift';
const input = read(fixture(`${name}.txt`));
const output = read(expected(`${name}.txt`));
const actual = strip(input, { language: name });
assert.strictEqual(actual, output);
});
});