Sha256: 8cbf9941571a0eb3ded6f7e913b66f1fecfede894627df7c4d0caa4c8f66b5ff
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
# -*- encoding: utf-8 -*- require File.expand_path('../fixtures/classes.rb', __FILE__) describe "String#rjust with length, padding" do it "returns a new string of specified length with self right justified and padded with padstr" do "hello".rjust(20, '1234').should == "123412341234123hello" "".rjust(1, "abcd").should == "a" "".rjust(2, "abcd").should == "ab" "".rjust(3, "abcd").should == "abc" "".rjust(4, "abcd").should == "abcd" "".rjust(6, "abcd").should == "abcdab" "OK".rjust(3, "abcd").should == "aOK" "OK".rjust(4, "abcd").should == "abOK" "OK".rjust(6, "abcd").should == "abcdOK" "OK".rjust(8, "abcd").should == "abcdabOK" end it "pads with whitespace if no padstr is given" do "hello".rjust(20).should == " hello" end it "returns self if it's longer than or as long as the specified length" do "".rjust(0).should == "" "".rjust(-1).should == "" "hello".rjust(4).should == "hello" "hello".rjust(-1).should == "hello" "this".rjust(3).should == "this" "radiology".rjust(8, '-').should == "radiology" end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
opal-0.5.5 | spec/opal/core/string/rjust_spec.rb |
opal-0.5.4 | spec/corelib/string/rjust_spec.rb |
opal-0.5.2 | spec/corelib/string/rjust_spec.rb |
opal-0.5.0 | spec/corelib/string/rjust_spec.rb |