red 4.0.6 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/array.red ADDED
@@ -0,0 +1,389 @@
1
+ Spec.describe Array do |it|
2
+ # it.can 'intersect' do
3
+ # ([1,1,3,5] & [1,2,3]).should_equal([1,3])
4
+ # end
5
+
6
+ it.can 'initialize with the [] literals' do
7
+ [1].should_equal([1])
8
+ end
9
+
10
+ it.can 'initialize with the %w() literal' do
11
+ %w(a).should_equal(['a'])
12
+ end
13
+
14
+ it.can 'multiply itself by an integer and return a larger array' do
15
+ ([1,2,3] * 2).should_equal([1,2,3,1,2,3])
16
+ end
17
+
18
+ it.can 'multiply itself by a string and return a joined string' do
19
+ ([1,2,3] * ":").should_equal('1:2:3')
20
+ end
21
+
22
+ it.can 'be added to another array, resulting in one large array' do
23
+ ([1,2,3] + [4,5]).should_equal([1, 2, 3, 4, 5])
24
+ end
25
+
26
+ it.can 'subtract another array, returning an array containing only items that appear in itself and not in the other' do
27
+ ([1,1,2,2,3,3,4,5] - [1,2,4]).should_equal([3, 3, 5])
28
+ end
29
+
30
+ it.can 'append an object to the its end as the last element' do
31
+ ([1,2] << 'c' << 'd' << [3,4]).should_equal([1, 2, "c", "d", [3, 4]])
32
+ end
33
+
34
+ it.can 'compare itself to another array' do
35
+ (['a','a','c'] <=> ['a','b','c']).should_equal(-1)
36
+ ([1,2,3,4,5,6] <=> [1,2]).should_equal(1)
37
+ ([1,2] <=> [1,2]).should_equal(0)
38
+ end
39
+
40
+ it.can 'check if its equal to another array' do
41
+ (['a','c'] == ['a', 'c', 7]).should_be_false
42
+ (['a','c', 7] == ['a', 'c', 7]).should_be_true
43
+ (['a','c', 7] == ['a', 'd', 'f']).should_be_false
44
+ end
45
+
46
+ it.can 'retrieve the object at a numeric index' do
47
+ a = ['a','b','c']
48
+ a[0].should_equal('a')
49
+ a.at(-1).should_equal('c')
50
+ a.at(0).should_equal('a')
51
+ a.slice(0).should_equal('a')
52
+ end
53
+
54
+ it.returns 'nil if the object at the numeric index is nil or index is greater than its length' do
55
+ ['a','b',nil][2].should_be_nil
56
+ ['a','b'][2].should_be_nil
57
+ ['a','b',nil].slice(2).should_be_nil
58
+ ['a','b'].slice(2).should_be_nil
59
+ end
60
+
61
+ it.returns 'a sub array based on a start position and length' do
62
+ (['a','b','c','d'][1,2]).should_equal(['b','c'])
63
+ end
64
+
65
+ it.returns 'a limited sub array when a start position and length are provided and position + length go beyond the size of the array' do
66
+ (['a','b','c','d'][3,2]).should_equal(['d'])
67
+ ['a','b','c','d'].slice(3,2).should_equal(['d'])
68
+ end
69
+
70
+ it.returns 'nil if a position and length are provided and position is past the size of the array' do
71
+ (['a','b','c','d'][4,2]).should_be_nil
72
+ ['a','b','c','d'].slice(4,2).should_be_nil
73
+ end
74
+
75
+ it.returns 'a sub array when a range is provided' do
76
+ (['a','b','c','d'][1..3]).should_equal(['b','c', 'd'])
77
+ ['a','b','c','d'].slice(1..3).should_equal(['b','c', 'd'])
78
+ end
79
+
80
+ it.returns 'a limited sub array when a range is provided and the range goes beyond the size of the array' do
81
+ (['a','b','c','d'][2..5]).should_equal(['c','d'])
82
+ ['a','b','c','d'].slice(2..5).should_equal(['c','d'])
83
+ end
84
+
85
+ it.returns 'nil if a range is provided and the range begins beyong the sie of the array' do
86
+ (['a','b','c','d'][4..5]).should_equal(nil)
87
+ ['a','b','c','d'].slice(4..5).should_equal(nil)
88
+ end
89
+
90
+ it.can 'assgin objects to a specific location in the array, overwriting as neccessary' do
91
+ a = ['0']
92
+ a[0] = 'zero'
93
+ a.should_equal(['zero'])
94
+ end
95
+
96
+ it.can 'assign objects to a specific location in the array, padding with nil if neccessary' do
97
+ a = []
98
+ a[4] = '4'
99
+ a.should_equal([nil,nil,nil,nil,'4'])
100
+ end
101
+
102
+ it.can 'assign objects from an array to a location in the array based on a start position and length' do
103
+ ([1,2,3,4,5,6,7][0,3] = ['a','b', 'c']).should_equal(['a','b','c',4,5,6,7])
104
+ end
105
+
106
+ it.can 'assign objects from an array to a location in the array based on a range' do
107
+ ([1,2,3,4,5,6,7][1..2] = ['a','b']).should_equal([1,'a','b',4,5,6,7])
108
+ end
109
+
110
+ it.can 'assoc' do
111
+ a = [['colors','red','blue','green'], ['letters','a','b','c'], 'foo']
112
+ a.assoc('letters').should_equal(["letters", "a", "b", "c"])
113
+ a.assoc('foo').should_be_nil
114
+ end
115
+
116
+ it.can 'clear' do
117
+ [3,2,1].clear.should_equal([])
118
+ end
119
+
120
+ it.can 'map additonal values into a new array' do
121
+ a = [1,2,3,4]
122
+ b = a.collect {|x| x + 100}
123
+ b.should_equal([101,102,103,104])
124
+ a.should_not_equal(b)
125
+
126
+ # map is an alias for collect
127
+ a = [1,2,3,4]
128
+ b = a.map {|x| x + 100}
129
+ b.should_equal([101,102,103,104])
130
+ a.should_not_equal(b)
131
+ end
132
+
133
+ it.can 'map additonal values into itself' do
134
+ a = [1,2,3,4]
135
+ b = a.collect! {|x| x + 100}
136
+ b.should_equal([101,102,103,104])
137
+ a.should_equal(b)
138
+
139
+ # map! is an alias for collect!
140
+ a = [1,2,3,4]
141
+ b = a.map! {|x| x + 100}
142
+ b.should_equal([101,102,103,104])
143
+ a.should_equal(b)
144
+ end
145
+
146
+ it.can 'remove nil elements' do
147
+ ['a',nil,'b',nil,'c'].compact!.should_equal(["a", "b", "c"])
148
+ end
149
+
150
+ it.returns 'nil when attempting to remove nil elements from an array that has no nil elements' do
151
+ ["a", "b", "c"].compact!.should_equal(nil)
152
+ end
153
+
154
+ it.can 'add the elelemts of a new array to its own end, as elements' do
155
+ [1,2].concat([3,4]).concat([5,6]).should_equal([1, 2, 3, 4, 5, 6])
156
+ end
157
+
158
+ it.can 'delete any objects in an array equal to a passed object, returning the passed object'
159
+
160
+ it.returns 'nil when attempting to delete an object from an array that does not contain the object' do
161
+ # ['a','b','b','b','c'].delete('z').should_equal(nil)
162
+ end
163
+
164
+ it.can 'delete objects from an array based on a provided block'
165
+
166
+ it.can 'delete an item at a specific index, returning the item' do
167
+ a = ['a','b','c','d']
168
+ a.delete_at(2).should_equal('c')
169
+ a.should_equal(['a','b','d'])
170
+ end
171
+
172
+ it.returns 'nil when attemping to delete an item at specific position if the array does not contain an object at the position' do
173
+ ['a','b','c','d'].delete_at(6).should_equal(nil)
174
+ end
175
+
176
+ it.can 'delete objects based on a specific equality checking block'
177
+ it.can 'loop through its elements'
178
+ it.can 'check whether it is empty'
179
+ it.can 'check whether it is equal to another array, returning true or false'
180
+
181
+ it.can 'fetch items with an index' do
182
+ ['a','b','c'].fetch(1).should_equal('b')
183
+ end
184
+
185
+ it.returns 'nil when fetching an item with a provided index beyond the length' do
186
+ ['a','b','c'].fetch(5).should_be_nil
187
+ end
188
+
189
+ it.returns 'a default value if one is provided when fetching at an index and there is no object at the index' do
190
+ ['a','b','c'].fetch(5, 'FAIL').should_equal('FAIL')
191
+ end
192
+
193
+ it.can 'call a blockon failed value fetching if a block is provided'
194
+
195
+ it.can 'fill itself with new values' do
196
+ ['a','b','c', 'd'].fill('x').should_equal(['x','x','x','x'])
197
+ end
198
+
199
+ it.can 'fill itself with new values starting a start position and continuing for an optional length' do
200
+ ['a','b','c', 'd'].fill('x', 2).should_equal(['a','b','x','x'])
201
+ ['a','b','c', 'd'].fill('x', 1,2).should_equal(['a','x','x','d'])
202
+ end
203
+
204
+ it.can 'get the its first element' do
205
+ ['1','2','3'].first.should_equal('1')
206
+ end
207
+
208
+ it.can 'get the its first n elements with a provider number' do
209
+ ['1','2','3'].first(2).should_equal(['1','2'])
210
+ end
211
+
212
+ it.can 'flatten and return a new flat array' do
213
+ a = ['a','b',['d','e','f'],'g']
214
+ b = a.flatten
215
+ a.should_not_equal(['a','b','d','e','f','g'])
216
+ b.should_equal(['a','b','d','e','f','g'])
217
+ end
218
+
219
+ it.can 'flatten itself' do
220
+ a = ['a','b',['d','e','f'],'g']
221
+ b = a.flatten!
222
+ a.should_equal(['a','b','d','e','f','g'])
223
+ b.should_equal(['a','b','d','e','f','g'])
224
+ end
225
+
226
+ it.returns 'nil if flattening itself and no changes were made' do
227
+ ['a','b','d','e','f','g'].flatten!.should_equal(nil)
228
+ end
229
+
230
+ it.can 'determine whether it includes an object returning true or false' do
231
+ ['a','b','c'].include?('a').should_be_true
232
+ ['a','b','c'].include?('d').should_be_false
233
+ end
234
+
235
+ it.returns 'the index of an object when looking for an object and the object is in the array' do
236
+ ['a','b','c'].index('a').should_equal(0)
237
+ end
238
+
239
+ it.returns 'nil when looking for an object and the object is not in the array' do
240
+ ['a','b','c'].index('d').should_be_nil
241
+ end
242
+
243
+ it.can 'insert an object before paritcular index' do
244
+ [1,2,3,4].insert(2,99).should_equal([1, 2, 99, 3, 4])
245
+ end
246
+
247
+ it.can 'insert an object before a paricular negative index' do
248
+ [1,2,3,4].insert(-2,'a','b','c').should_equal([1, 2, 3, "a", "b", "c", 4])
249
+ end
250
+
251
+ it.returns 'printable version of itself' do
252
+ [1,2,3].inspect.should_equal("[1, 2, 3]")
253
+ end
254
+
255
+ it.can 'join each element with a string, returning a new string' do
256
+ ['a','b','c'].join(',').should_equal('a,b,c')
257
+ end
258
+
259
+
260
+ it.can 'get the its last element' do
261
+ ['1','2','3'].last.should_equal('3')
262
+ end
263
+
264
+ it.can 'get the its last n elements with a provider number' do
265
+ ['1','2','3'].last(2).should_equal(['2','3'])
266
+ end
267
+
268
+ it.can 'provide its length as a number' do
269
+ a = ['1','2','3']
270
+ a.size.should_equal(3)
271
+ a.length.should_equal(3)
272
+ end
273
+
274
+ it.returns 'the number of non-nil items' do
275
+ [1, nil, 3, nil, 5].nitems.should_equal(3)
276
+ end
277
+
278
+ it.can 'remove its last item returing that item' do
279
+ a = ['1','2','3']
280
+ a.pop.should_equal('3')
281
+ a.should_equal(['1','2'])
282
+ end
283
+
284
+ it.returns 'nil when attempting to pop an item when empty' do
285
+ [].pop.should_equal(nil)
286
+ end
287
+
288
+ it.can 'append items to its end, returning itself' do
289
+ [1,2,3].push(4).push(5,6,7).should_equal([1, 2, 3, 4, 5, 6, 7])
290
+ end
291
+
292
+ it.can 'rassoc' do
293
+ a = [[1,'one'], [2,'two'], [:ii,'two']]
294
+ a.rassoc('two').should_equal([2, "two"])
295
+ a.rassoc('three').should_be_nil
296
+ end
297
+
298
+ it.can 'create a new array with rejected elements removed' do
299
+ a = [1,2,3,4,5]
300
+ b = a.reject {|x| x > 3 }
301
+ b.should_equal([1, 2, 3])
302
+ a.should_not_equal(b)
303
+ end
304
+
305
+ it.can 'remove every element for which block evaluates to true' do
306
+ a = [1,2,3,4,5]
307
+ b = a.reject {|x| x > 3 }
308
+ b.should_equal([1, 2, 3])
309
+ a.should_equal(b)
310
+ end
311
+
312
+ it.can 'repalce its contents with the contents of another array, truncating or expanding if necessary' do
313
+ ['a','b','c'].replace(['w','x','y', 'z']).should_equal(["w", "x", "y", "z"])
314
+ end
315
+
316
+ it.can 'return a reversed array' do
317
+ a = [1,2,3,4,5]
318
+ b = a.reverse
319
+ b.should_equal([5,4,3,2,1])
320
+ a.should_equal([1,2,3,4,5])
321
+ end
322
+
323
+ it.can 'reverse itself' do
324
+ a = [1,2,3,4,5]
325
+ b = a.reverse!
326
+ b.should_equal([5,4,3,2,1])
327
+ a.should_equal([5,4,3,2,1])
328
+ end
329
+
330
+ it.can 'return a sorted array' do
331
+ a = [3, 2, 4, 1]
332
+ b = a.sort
333
+ b.should_equal([1,2,3,4])
334
+ a.should_not_equal(b)
335
+ end
336
+
337
+ it.can 'sort itself' do
338
+ a = [3, 2, 4, 1]
339
+ b = a.sort!
340
+ b.should_equal([1,2,3,4])
341
+ a.should_equal(b)
342
+ end
343
+
344
+ it.can 'convert itself to an array' do
345
+ [1,2,3].to_a.should_equal([1, 2, 3])
346
+ end
347
+
348
+ it.can 'convert itself to a string, calling .to_s on each element' do
349
+ [1,2,3].to_s.should_equal('123')
350
+ end
351
+
352
+ it.can 'transpose' do
353
+ [[1,2],[3,4],[5,6]].transpose.should_equal([[1, 3, 5], [2, 4, 6]])
354
+ end
355
+
356
+ it.can 'return a new array with repeated elements removed' do
357
+ a = ['a','b','b','c','c','c']
358
+ b = a.uniq
359
+ a.should_not_equal(["a", "b", "c"])
360
+ b.should_equal(["a", "b", "c"])
361
+ a.should_not_equal(b)
362
+ end
363
+
364
+ it.can 'remove repeated elements from itself' do
365
+ a = ['a','b','b','c','c','c']
366
+ b = a.uniq!
367
+ a.should_equal(["a", "b", "c"])
368
+ b.should_equal(["a", "b", "c"])
369
+ a.should_equal(b)
370
+ end
371
+
372
+ it.returns 'nil if removing repeated elements from itself has no effect' do
373
+ ["a", "b", "c"].uniq!.should_equal(nil)
374
+ end
375
+
376
+ it.can 'prepend objects to the front, shifting the indices of another array\'s other elements up one, then returns itself' do
377
+ a = ['b','c']
378
+ a.unshift('a').should_equal(["a", "b", "c"])
379
+ a.unshift(1,2,3).should_equal([1, 2, 3, "a", "b", "c"])
380
+ end
381
+
382
+ it.can 'retrurn an array containing the elements in self corresponding to the given selector(s)'
383
+ it.can 'combine with another array instering elements at a position in one the same indexed element in the other (zipping)'
384
+
385
+ it.can 'provider a union of two arrays' do
386
+ ([1,2,3] | [3,4,1]).should_equal([1, 2, 3, 4])
387
+ end
388
+
389
+ end
data/spec/hash.red ADDED
@@ -0,0 +1,137 @@
1
+ Spec.describe Hash do |it|
2
+ it.can 'initialize itself with { } literals' do
3
+ {'a' => 'b'}.should_equal({'a' => 'b'})
4
+ end
5
+
6
+ it.can 'initialize itself with through the Hash.new' do
7
+ Hash.new.should_equal({})
8
+ end
9
+
10
+ # TODO: BROKE
11
+ it.can 'take a default value to return if accessing a missing key' do
12
+ # h = Hash.new('unknown key')
13
+ # h[:not_there].should_equal('unknown key')
14
+ end
15
+
16
+ # TODO: BROKE
17
+ it.can 'alter the default key by accessing an unknow key and changing it' do
18
+ # h = Hash.new('unknown key')
19
+ # h[:not_there].upcase
20
+ # h[:not_anywhere].should_equal('UNKNOWN KEY')
21
+ end
22
+
23
+ it.does_not 'store values from the defaults in the hash' do
24
+ h = Hash.new('unknown key')
25
+ h[:a] = 1
26
+ h[:b] = 2
27
+ h.keys.should_equal([:a, :b])
28
+ end
29
+
30
+ it.can 'determine whether its contents are equal to the contents of another hash' do
31
+ ({'a' => 'b'} == {'a' => 'b'}).should_be_true
32
+ ({'d' => 'b'} == {'a' => 'b'}).should_be_false
33
+ end
34
+
35
+ it.can 'retrive and element by its key' do
36
+ {:a => 'b'}[:a].should_equal('b')
37
+ end
38
+
39
+ it.returns 'nil when attempting to retrieve an element with a non-existent key' do
40
+ {:a => 'b'}['n'].should_equal(nil)
41
+ end
42
+
43
+ it.can 'store an element to be accessed by the provided key' do
44
+ h1 = {}
45
+ (h1['a'] = 'stored').should_equal('stored')
46
+ h1.should_equal({'a' => 'stored'})
47
+
48
+ h2 = {}
49
+ h2.store('a', 'stored').should_equal('stored')
50
+
51
+ h2.should_equal({'a' => 'stored'})
52
+ end
53
+
54
+ it.can 'clear itself' do
55
+ {'a' => 1, 'b' => 2}.clear.should_equal({})
56
+ end
57
+
58
+ it.can 'default'
59
+ it.can 'default='
60
+ it.can 'default_proc='
61
+
62
+ it.can 'delete elements' do
63
+ h = {:a => 100, :b => 200}
64
+ h.delete(:a).should_equal(100)
65
+ h.should_equal({:b => 200})
66
+ end
67
+
68
+ it.can 'delete elements based on a block' do
69
+ h = {:a => 100, :b => 200, :c => 300 }
70
+ h.delete_if {|k,v| v >= 200 }
71
+ h.should_equal({:a => 100})
72
+ end
73
+
74
+ it.can 'loop' do
75
+ h = {:a => 100, :b => 200, :c => 300 }
76
+ h.each {|k,v| v += 10}
77
+ h.should_equal({:a => 110, :b => 220, :c => 300 })
78
+ end
79
+
80
+ it.can 'loop through each key'
81
+ it.can 'loop through each value'
82
+ it.can 'be checked for emptiness'
83
+ it.can 'fetch'
84
+
85
+ it.can 'tell if it includes a key'
86
+ it.can 'tell if it includes a key'
87
+
88
+ it.can 'return the key for a given value'
89
+ it.returns 'nil if there is no key for a given value'
90
+
91
+ it.can 'format an inspectable string of itself' do
92
+ h = Hash[:a,100,:b,200].inspect.should_equal("{:a => 100, :b => 200}")
93
+ end
94
+
95
+ it.can 'return a new hash with keys and values inverted' do
96
+ {:n => 100, :m => 100, :y => 300, :d => 200, :a => 0 }.invert.should_equal({100 => :m, 300 => :y, 200 => :d, 0 => :a})
97
+ end
98
+
99
+ it.can 'provide an array of its keys' do
100
+ {:a => 100, :b => 200}.keys.should_equal([:a,:b])
101
+ end
102
+
103
+ it.can 'give its length as a number' do
104
+ h = {:a => 100, :b => 200}
105
+ h.size.should_equal(2)
106
+ h.length.should_equal(2)
107
+ end
108
+
109
+ it.can 'merge with another hash, retuning a new hash' do
110
+ a = {:a => 100, :b => 200}
111
+ b = a.merge({:a => 150, :c => 300})
112
+ b.should_equal({:a => 150, :b => 200, :c => 300})
113
+ a.should_not_equal(b)
114
+ end
115
+
116
+ it.can 'merge with another hash altering itself' do
117
+ a = {:a => 100, :b => 200}
118
+ b = a.merge!({:a => 150, :c => 300})
119
+ b.should_equal({:a => 150, :b => 200, :c => 300})
120
+ a.should_equal(b)
121
+ end
122
+
123
+ it.can 'reject certain elements based on a block and return a new hash'
124
+ it.can 'reject certain elements based on a block and alter its own contents'
125
+ it.can 'replace its contents with the contents of another hash'
126
+ it.can 'select'
127
+ it.can 'remove a key-value pair from itself and return a two-item array [key, value]'
128
+ it.returns 'its default value when attempting to remove a key-value pair from itself and the hash is nil'
129
+
130
+ it.can 'sort and return an array of nested [key,value] arrays, sorted'
131
+ it.can 'convert to an array of nested [key,value] arrays'
132
+
133
+ it.can 'convert to a string'
134
+ it.can 'tell if it has a value'
135
+ it.can 'return an array of its values'
136
+ it.can 'return an array of values stored at one or more key location'
137
+ end
data/spec/object.red ADDED
@@ -0,0 +1,22 @@
1
+ Spec.describe Object do |it|
2
+ it.can 'find its class'
3
+
4
+ it.can 'be extended with additioanl functionality' do
5
+ module Stuff
6
+ def x
7
+ end
8
+ end
9
+
10
+ o = Object.new
11
+ o.extend(Stuff)
12
+ o.respond_to?(:x).should_be_true
13
+ end
14
+
15
+ it.has 'an object_id' do
16
+ Object.new.object_id.should_not_be_nil
17
+ end
18
+
19
+ it.can 'tell whether it will respond to a method referenced as a symbol' do
20
+ Object.respond_to?(:respond_to?).should_be_true
21
+ end
22
+ end
data/spec/string.red ADDED
@@ -0,0 +1,74 @@
1
+ Spec.describe String do |it|
2
+ it.can 'initialze with the " " literals' do
3
+ 'red'.should_equal(String.new('red'))
4
+ end
5
+
6
+ it.can 'format itself using sprintf notation' do
7
+ ("%05d" % 123).should_equal('00123')
8
+ end
9
+
10
+ it.can 'multiply by a number' do
11
+ ('abc ' * 3).should_equal('abc abc abc ')
12
+ end
13
+
14
+ it.can 'be added to another string' do
15
+ ('abc' + 'def').should_equal('abcdef')
16
+ end
17
+
18
+ it.can 'have new characters added to its end' do
19
+ ('abc' << 'def').should_equal('abcdef')
20
+ 'abc'.concat('def').should_equal('abcdef')
21
+ end
22
+
23
+ it.can 'have new numbers added to its end, which become characters if between 0 and 255' do
24
+ ('a' << 103 << 104).should_equal('agh')
25
+ ('a'.concat(103).concat(104)).should_equal('agh')
26
+ end
27
+
28
+ it.can 'compare itself to other strings' do
29
+ ('abcdef' <=> 'abcde' ).should_equal(1)
30
+ ('abcdef' <=> 'abcdef' ).should_equal(0)
31
+ ('abcdef' <=> 'abcdefg').should_equal(-1)
32
+ ('abcdef' <=> 'ABCDEF' ).should_equal(1)
33
+ end
34
+
35
+ # TODO: BROKE
36
+ it.can 'check if it is equal to another string' do
37
+ # ('abc' == 'abc').should_equal(true)
38
+ # ('abc' == 'ac').should_equal(false)
39
+ end
40
+
41
+ it.can 'return a capitalized version of itself' do
42
+ a = 'abcdef'
43
+ b = a.capitalize
44
+ b.should_equal('Abcdef')
45
+ a.should_equal('abcdef')
46
+
47
+ a = 'ABCDEF'
48
+ b = a.capitalize
49
+ b.should_equal('Abcdef')
50
+ a.should_equal('ABCDEF')
51
+
52
+ a = '123ABC'
53
+ b = a.capitalize
54
+ b.should_equal('123abc')
55
+ a.should_equal('123ABC')
56
+ end
57
+
58
+ it.can 'capitalize itself' do
59
+ a = 'abcdef'
60
+ b = a.capitalize!
61
+ b.should_equal('Abcdef')
62
+ a.should_equal('Abcdef')
63
+
64
+ a = 'ABCDEF'
65
+ b = a.capitalize!
66
+ b.should_equal('Abcdef')
67
+ a.should_equal('Abcdef')
68
+
69
+ a = '123ABC'
70
+ b = a.capitalize!
71
+ b.should_equal('123abc')
72
+ a.should_equal('123abc')
73
+ end
74
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: red
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.6
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Sielaff
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-19 00:00:00 -04:00
12
+ date: 2008-11-05 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,7 +40,7 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 1.7.0
43
+ version: 1.8.2
44
44
  version:
45
45
  description: Red writes like Ruby and runs like JavaScript.
46
46
  email:
@@ -85,9 +85,10 @@ files:
85
85
  - script/generate
86
86
  - script/txt2html
87
87
  - setup.rb
88
- - spec/red_spec.rb
89
- - spec/spec.opts
90
- - spec/spec_helper.rb
88
+ - spec/array.red
89
+ - spec/hash.red
90
+ - spec/object.red
91
+ - spec/string.red
91
92
  - tasks/deployment.rake
92
93
  - tasks/environment.rake
93
94
  - tasks/rspec.rake
data/spec/red_spec.rb DELETED
@@ -1,10 +0,0 @@
1
- require File.dirname(__FILE__) + '/spec_helper.rb'
2
-
3
- # http://rspec.info/
4
- describe "Place your specs here" do
5
-
6
- it "find this spec in spec directory" do
7
- violated "Be sure to write your specs"
8
- end
9
-
10
- end
data/spec/spec.opts DELETED
@@ -1 +0,0 @@
1
- --colour
data/spec/spec_helper.rb DELETED
@@ -1,10 +0,0 @@
1
- begin
2
- require 'spec'
3
- rescue LoadError
4
- require 'rubygems'
5
- gem 'rspec'
6
- require 'spec'
7
- end
8
-
9
- $:.unshift(File.dirname(__FILE__) + '/../lib')
10
- require 'red'