Guest User

Untitled

a guest
Apr 16th, 2018
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. david@MacSkull ~/dev/rubyspec$ git add core/io/gets_spec.rb
  2.  
  3. david@MacSkull ~/dev/rubyspec$ git ci -m "added specs for IO.gets with an integer as parameter to limit the outputs's size"
  4. Created commit b12220d: added specs for IO.gets with an integer as parameter to limit the outputs's size
  5. 1 files changed, 26 insertions(+), 0 deletions(-)
  6.  
  7. david@MacSkull ~/dev/rubyspec$ git push origin master
  8. Counting objects: 9, done.
  9. Compressing objects: 100% (5/5), done.
  10. Writing objects: 100% (5/5), 694 bytes, done.
  11. Total 5 (delta 4), reused 0 (delta 0)
  12. To git@github.com:rubyspec/rubyspec.git
  13. 26acc58..b12220d master -> master
  14.  
  15.  
  16. david@MacSkull ~/dev/rubyspec$ git show b12220d
  17. commit b12220d7cc076a1fd9ed23811d2e169546e73b8e
  18. Author: David Calavera <david.calavera@gmail.com>
  19. Date: Mon Sep 14 21:12:56 2009 +0200
  20.  
  21. added specs for IO.gets with an integer as parameter to limit the outputs's size
  22.  
  23. diff --git a/core/io/gets_spec.rb b/core/io/gets_spec.rb
  24. index 0ea7bec..454ebab 100644
  25. --- a/core/io/gets_spec.rb
  26. +++ b/core/io/gets_spec.rb
  27. @@ -189,4 +189,30 @@ describe "IO#gets" do
  28. b.should == "\nB\n"
  29. File.unlink(tmp("gets_specs"))
  30. end
  31. +
  32. + ruby_version_is "1.9" do
  33. + it "accepts an integer as first parameter to limit the output's size" do
  34. + f = File.open(tmp("gets_specs"), "w")
  35. + f.print("waduswadus")
  36. + f.close
  37. +
  38. + f = File.new(tmp("gets_specs"), "r")
  39. + b = f.gets(5)
  40. + b.should == 'wadus'
  41. +
  42. + File.unlink(tmp("gets_specs"))
  43. + end
  44. +
  45. + it "accepts an integer as second parameter to limit the output's size" do
  46. + f = File.open(tmp("gets_specs"), "w")
  47. + f.print("wa\n\ndus\n\nwadus")
  48. + f.close
  49. +
  50. + f = File.new(tmp("gets_specs"), "r")
  51. + b = f.gets('\n\n', 5)
  52. + b.should == "wa\n\nd"
  53. +
  54. + File.unlink(tmp("gets_specs"))
  55. + end
  56. + end
  57. end
Add Comment
Please, Sign In to add comment