Skip to content
This repository
Newer
Older
100644 38 lines (30 sloc) 1.161 kb
2ada3f2a »
2009-05-28 String#bytesize First pass at a specification.
1 # -*- encoding: utf-8 -*-
957c2c9c »
2010-02-17 Standardize require lines.
2 require File.expand_path('../../../spec_helper', __FILE__)
3 require File.expand_path('../fixtures/classes.rb', __FILE__)
2ada3f2a »
2009-05-28 String#bytesize First pass at a specification.
4
74e52454 »
2010-02-10 Added with_feature guards to String for encoding.
5 with_feature :encoding do
2ada3f2a »
2009-05-28 String#bytesize First pass at a specification.
6 describe "#String#bytesize" do
7 it "needs to be reviewed for spec completeness"
8
9 it "returns the length of self in bytes" do
10 "hello".bytesize.should == 5
11 " ".bytesize.should == 1
12 end
356fa4fb »
2011-04-14 Finally cleaned up trailing whitespace in spec files.
13
2ada3f2a »
2009-05-28 String#bytesize First pass at a specification.
14 it "works with strings containing single UTF-8 characters" do
15 "\u{6666}".bytesize.should == 3
16 end
17
ba72c1b8 »
2009-06-28 s/psuedo/pseudo/
18 it "works with pseudo-ASCII strings containing single UTF-8 characters" do
2ada3f2a »
2009-05-28 String#bytesize First pass at a specification.
19 "\u{6666}".force_encoding('ASCII').bytesize.should == 3
20 end
356fa4fb »
2011-04-14 Finally cleaned up trailing whitespace in spec files.
21
2ada3f2a »
2009-05-28 String#bytesize First pass at a specification.
22 it "works with strings containing UTF-8 characters" do
23 "c \u{6666}".force_encoding('UTF-8').bytesize.should == 5
24 "c \u{6666}".bytesize.should == 5
25 end
356fa4fb »
2011-04-14 Finally cleaned up trailing whitespace in spec files.
26
ba72c1b8 »
2009-06-28 s/psuedo/pseudo/
27 it "works with pseudo-ASCII strings containing UTF-8 characters" do
2ada3f2a »
2009-05-28 String#bytesize First pass at a specification.
28 "c \u{6666}".force_encoding('ASCII').bytesize.should == 5
29 end
356fa4fb »
2011-04-14 Finally cleaned up trailing whitespace in spec files.
30
2ada3f2a »
2009-05-28 String#bytesize First pass at a specification.
31 it "returns 0 for the empty string" do
32 "".bytesize.should == 0
33 "".force_encoding('ASCII').bytesize.should == 0
34 "".force_encoding('UTF-8').bytesize.should == 0
35 end
36 end
37 end
Something went wrong with that request. Please try again.