-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtests.rb
105 lines (99 loc) · 1.67 KB
/
tests.rb
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
require_relative 'libhtmltable.rb'
table_1 = '<table style="width:100%">
<tr>
<th>City</th>
<th>Country</th>
<th>Population</th>
</tr>
<tr>
<td>Conakry</td>
<td>Guinea</td>
<td>1,660,973</td>
</tr>
<tr>
<td>Freetown</td>
<td>Sierra Leone</td>
<td>1,055,964</td>
</tr>
<tr>
<td>Monrovia</td>
<td>Liberia</td>
<td>1,010,970</td>
</tr>
</table>'
table_2 = '<table style="width:100%">
<tr>
<th>城市</th>
<th>国家</th>
<th>人口</th>
</tr>
<tr>
<td>科纳克里</td>
<td>几内亚</td>
<td>1,660,973</td>
</tr>
<tr>
<td>弗里敦</td>
<td>塞拉利昂</td>
<td>1,055,964</td>
</tr>
<tr>
<td>蒙罗维亚</td>
<td>利比里亚</td>
<td>1,010,970</td>
</tr>
</table>'
table_3 = '<table style="width:100%">
<tr>
<th>City</th>
<th>Country</th>
<th>Population</th>
</tr>
<tr>
<td>
<table>
<tr><td>nested table</td></tr>
<tr><td>nested table</td></tr>
</table>
</td>
</tr>
<tr>
<td>Conakry</td>
<td>Guinea</td>
<td>1,660,973</td>
</tr>
<tr>
<td>Freetown</td>
<td>Sierra Leone</td>
<td>1,055,964</td>
</tr>
<tr>
<td>Monrovia</td>
<td>Liberia</td>
<td>1,010,970</td>
</tr>
</table>'
puts "Test: Basic table (CSV)"
puts
table_to_csv(table_1)
puts
puts "Test: Basic table (tabs)"
puts
table_to_tsv(table_1)
puts
puts "Test: Table with Unicode (CSV)"
puts
table_to_csv(table_2)
puts
puts "Test: Table with Unicode (tabs)"
puts
table_to_tsv(table_2)
puts
puts "Test: Nested table (CSV)"
puts
table_to_csv(table_3)
puts
puts "Test: Nested table (tabs)"
puts
table_to_tsv(table_3)
puts