File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change
1
+ import
2
+ /*
3
+ /**
4
+ *
5
+ */
6
+ //
7
+ from
8
+ as
Original file line number Diff line number Diff line change
1
+ require "test_helper"
2
+
3
+ module SnippetExtractor
4
+ module Languages
5
+ class TypescriptTest < Minitest ::Test
6
+ def test_full_example
7
+ code = <<~CODE
8
+
9
+ // Skipping imports
10
+ import * as example from 'example.js'
11
+ import *
12
+ as example
13
+ from 'example.js'
14
+
15
+ import { get_data, get_data2 } from 'example.js
16
+
17
+ /// Saying things over
18
+ /// multiple lines of code
19
+
20
+ /* Multiline comments */
21
+ /**
22
+ * Multiline comments 2
23
+ *
24
+ */
25
+
26
+ let numberRegexp = /^[0-9]+$/;
27
+ class ZipCodeValidator {
28
+ isAcceptable(s: string) {
29
+ return s.length === 5 && numberRegexp.test(s);
30
+ }
31
+ }
32
+ export = ZipCodeValidator;
33
+ CODE
34
+
35
+ expected = <<~CODE
36
+ let numberRegexp = /^[0-9]+$/;
37
+ class ZipCodeValidator {
38
+ isAcceptable(s: string) {
39
+ return s.length === 5 && numberRegexp.test(s);
40
+ }
41
+ }
42
+ export = ZipCodeValidator;
43
+ CODE
44
+
45
+ assert_equal expected , ExtractSnippet . ( code , :typescript )
46
+ end
47
+ end
48
+ end
49
+ end
You can’t perform that action at this time.
0 commit comments