Skip to content
This repository

Add basic specs for String#% %<foo> form. #120

Merged
merged 1 commit into from over 1 year ago

1 participant

Charles Oliver Nutter
Charles Oliver Nutter
Collaborator

No description provided.

Charles Oliver Nutter headius merged commit de565d9 into from October 29, 2012
Charles Oliver Nutter headius closed this October 29, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Feb 13, 2012
Charles Oliver Nutter Add basic specs for String#% %<foo> form. 764b5c9
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 14 additions and 0 deletions. Show diff stats Hide diff stats

  1. 14  core/string/modulo_spec.rb
14  core/string/modulo_spec.rb
@@ -934,5 +934,19 @@ def obj.to_s() "obj" end
934 934
         lambda {"%{foo}" % []}.should raise_error(ArgumentError)
935 935
       end
936 936
     end
  937
+    
  938
+    describe "when format string contains %<> formats" do
  939
+      it "uses the named argument for the format's value" do
  940
+        ("%<foo>d" % {:foo => 1}).should == "1"
  941
+      end
  942
+      
  943
+      it "raises KeyError if key is missing from passed-in hash" do
  944
+        lambda {"%<foo>d" % {}}.should raise_error(KeyError)
  945
+      end
  946
+      
  947
+      it "should raise ArgumentError if no hash given" do
  948
+        lambda {"%<foo>" % []}.should raise_error(ArgumentError)
  949
+      end
  950
+    end
937 951
   end
938 952
 end
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.