~ubuntu-branches/ubuntu/trusty/ruby1.9/trusty

« back to all changes in this revision

Viewing changes to bootstraptest/test_m17n.rb

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2008-05-16 12:37:06 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20080516123706-r4llcdfd35aobrjv
Tags: 1.9.0.1-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Robustify check for target_os, fixing build failure on lpia.
* debian/control:
  - ruby1.9 pkg: moved rdoc1.9 suggestion to depends. (LP: #228345)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
assert_normal_exit %q{
2
 
  "abcdefghij\xf0".force_encoding("utf-8").reverse.inspect
3
 
}, '[ruby-dev:32448]'
4
 
 
5
 
assert_equal 'true', %q{
6
 
  "abc".sub(/b/, "\xa1\xa1".force_encoding("euc-jp")) ==
7
 
  "a\xa1\xa1c".force_encoding("euc-jp")
8
 
}
9
 
 
10
 
assert_equal 'ok', %q{
11
 
  begin
12
 
    if ("\xa1\xa2\xa1\xa3").force_encoding("euc-jp").split(//) ==
13
 
      ["\xa1\xa2".force_encoding("euc-jp"), "\xa1\xa3".force_encoding("euc-jp")]
14
 
      :ok
15
 
    else
16
 
      :ng
17
 
    end
18
 
  rescue
19
 
    :ng
20
 
  end
21
 
}, '[ruby-dev:32452]'
22
 
 
23
 
assert_equal 'ok', %q{
24
 
  begin
25
 
    "\xa1\xa1".force_encoding("euc-jp") + "\xa1".force_encoding("ascii-8bit")
26
 
    :ng
27
 
  rescue ArgumentError
28
 
    :ok
29
 
  end
30
 
}
31
 
 
32
 
assert_equal 'ok', %q{
33
 
  begin
34
 
    "%s%s" % ["\xc2\xa1".force_encoding("sjis"), "\xc2\xa1".force_encoding("euc-jp")]
35
 
  rescue ArgumentError
36
 
    :ok
37
 
  end
38
 
}
39
 
 
40
 
assert_equal '0', %q{
41
 
  "\xa1\xa2".force_encoding("euc-jp").count("z")
42
 
}
43
 
 
44
 
assert_equal '1', %q{
45
 
  "\xa1\xa2".force_encoding("euc-jp").delete("z").length
46
 
}
47
 
 
48
 
assert_equal 'false', %q{
49
 
  "\xa1\xa2\xa3\xa4".force_encoding("euc-jp").include?("\xa3".force_encoding("euc-jp"))
50
 
}
51
 
 
52
 
assert_equal 'ok', %q{
53
 
  "\xa1\xa2\xa3\xa4".force_encoding("euc-jp").index("\xa3".force_encoding("euc-jp")) or :ok
54
 
}
55
 
 
56
 
assert_equal 'ok', %q{
57
 
  "\xa1\xa2\xa3\xa4".force_encoding("euc-jp").rindex("\xa3".force_encoding("euc-jp")) or :ok
58
 
}
59
 
 
60
 
assert_equal 'false', %q{
61
 
  s1 = "\xa1\xa1".force_encoding("euc-jp")
62
 
  s2 = s1.dup
63
 
  (94*94+94).times { s2.next! }
64
 
  s1 == s2
65
 
}
66
 
 
67
 
assert_equal 'ok', %q{
68
 
  "\xa1\xa2a\xa3\xa4".force_encoding("euc-jp").scan(/a/)
69
 
  :ok
70
 
}
71
 
 
72
 
assert_equal 'ok', %q{
73
 
  "\xa1\xa2a\xa3\xa4".force_encoding("euc-jp").split(/a/)
74
 
  :ok
75
 
}
76
 
 
77
 
assert_equal 'ok', %q{
78
 
  s1 = "\xa1\xa2".force_encoding("euc-jp")
79
 
  s2 = "\xa1\xa2".force_encoding("sjis")
80
 
  begin
81
 
    s1.upto(s2) {|x| break }
82
 
    :ng
83
 
  rescue ArgumentError
84
 
    :ok
85
 
  end
86
 
}
87
 
 
88
 
assert_equal 'true', %q{
89
 
  "%s" % "\xa1\xa1".force_encoding("euc-jp") ==
90
 
  "\xa1\xa1".force_encoding("euc-jp")
91
 
}
92
 
 
93
 
assert_equal 'a', %q{
94
 
  s = "a".dup.force_encoding("EUC-JP")
95
 
  s.length
96
 
  s[0,2]
97
 
}
98
 
 
99
 
assert_equal 'ok', %q{
100
 
  s1 = "\x81\x41".force_encoding("sjis")
101
 
  s2 = "\x81\x61".force_encoding("sjis")
102
 
  s1.casecmp(s2) == 0 ? :ng : :ok
103
 
}
104
 
 
105
 
assert_equal 'EUC-JP', %q{ ("\xc2\xa1 %s".force_encoding("EUC-JP") % "foo").encoding.name }
106
 
assert_equal 'true', %q{ "\xa1\xa2\xa3\xa4".force_encoding("euc-jp")["\xa2\xa3".force_encoding("euc-jp")] == nil }
107
 
assert_equal 'ok', %q{
108
 
  s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
109
 
  begin
110
 
    s["\xb0\xa3"] = "foo"
111
 
    :ng
112
 
  rescue ArgumentError
113
 
    :ok
114
 
  end
115
 
}
116
 
 
117
 
assert_equal 'EUC-JP', %q{ "\xa3\xb0".force_encoding("EUC-JP").center(10).encoding.name }
118
 
 
119
 
assert_equal 'ok', %q{
120
 
  s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
121
 
  begin
122
 
    s.chomp("\xa3\xb4".force_encoding("shift_jis"))
123
 
    :ng
124
 
  rescue ArgumentError
125
 
    :ok
126
 
  end
127
 
}
128
 
 
129
 
assert_equal 'ok', %q{
130
 
  s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
131
 
  begin
132
 
    s.count("\xa3\xb0".force_encoding("ascii-8bit"))
133
 
    :ng
134
 
  rescue ArgumentError
135
 
    :ok
136
 
  end
137
 
}
138
 
 
139
 
assert_equal 'ok', %q{
140
 
  s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
141
 
  begin
142
 
    s.delete("\xa3\xb2".force_encoding("ascii-8bit")) 
143
 
    :ng
144
 
  rescue ArgumentError
145
 
    :ok
146
 
  end
147
 
}
148
 
 
149
 
assert_equal 'ok', %q{
150
 
  s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
151
 
  begin
152
 
    s.each_line("\xa3\xb1".force_encoding("ascii-8bit")) {|l| }    
153
 
    :ng
154
 
  rescue ArgumentError
155
 
    :ok
156
 
  end
157
 
}
158
 
 
159
 
assert_equal 'true', %q{
160
 
  s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
161
 
  s.gsub(/\xa3\xb1/e, "z") == "\xa3\xb0z\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
162
 
}
163
 
 
164
 
assert_equal 'false', %q{
165
 
  s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
166
 
  s.include?("\xb0\xa3".force_encoding("euc-jp"))
167
 
}
168
 
 
169
 
assert_equal 'ok', %q{
170
 
  s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
171
 
  s.index("\xb3\xa3".force_encoding("euc-jp")) or :ok
172
 
}
173
 
 
174
 
assert_equal 'ok', %q{
175
 
  s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
176
 
  s.insert(-1, "a")
177
 
  :ok
178
 
}
179
 
 
180
 
assert_finish 1, %q{ "\xa3\xfe".force_encoding("euc-jp").next }
181
 
 
182
 
assert_equal 'ok', %q{
183
 
  s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
184
 
  begin
185
 
    s.rindex("\xb1\xa3".force_encoding("ascii-8bit"))
186
 
    :ng
187
 
  rescue ArgumentError
188
 
    :ok
189
 
  end
190
 
}
191
 
 
192
 
assert_equal 'true', %q{
193
 
  s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
194
 
  s.split("\xa3\xb1".force_encoding("euc-jp")) == [
195
 
    "\xa3\xb0".force_encoding("euc-jp"),
196
 
    "\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
197
 
  ]
198
 
}, '[ruby-dev:32452]'
199
 
 
200
 
assert_normal_exit %q{ // =~ :a }