PageRenderTime 69ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/dev-ruby/fakefs/files/fakefs-0.4.0-ruby193-advise.patch

http://github.com/funtoo/portage
Patch | 42 lines | 38 code | 4 blank | 0 comment | 0 complexity | f658304df8eee13a08aebaf110319297 MD5 | raw file
Possible License(s): Apache-2.0, AGPL-1.0, LGPL-2.1, MIT, CC-BY-SA-3.0, LGPL-2.0, Unlicense, AGPL-3.0, CC0-1.0, BSD-3-Clause, GPL-2.0, LGPL-3.0, MPL-2.0-no-copyleft-exception, GPL-3.0
  1. commit 332735b52720466ca8eb9e089cc42f128d54b644
  2. Author: Lukas Oberhuber <lukaso@gmail.com>
  3. Date: Tue Dec 20 09:19:05 2011 +0000
  4. Add advise function to File which is in ruby 1.9.3. As it is only a hint to the
  5. os in some cases, the function does nothing.
  6. diff --git a/lib/fakefs/file.rb b/lib/fakefs/file.rb
  7. index 5684ede..ebc3ff8 100644
  8. --- a/lib/fakefs/file.rb
  9. +++ b/lib/fakefs/file.rb
  10. @@ -392,6 +392,11 @@ module FakeFS
  11. end
  12. end
  13. + if RUBY_VERSION >= "1.9.3"
  14. + def advise(advice, offset=0, len=0)
  15. + end
  16. + end
  17. +
  18. private
  19. def check_modes!
  20. diff --git a/test/fakefs_test.rb b/test/fakefs_test.rb
  21. index 0f34950..1d5bf7a 100644
  22. --- a/test/fakefs_test.rb
  23. +++ b/test/fakefs_test.rb
  24. @@ -1861,4 +1861,14 @@ class FakeFSTest < Test::Unit::TestCase
  25. end
  26. end
  27. end
  28. +
  29. + if RUBY_VERSION >= "1.9.3"
  30. + def test_advise
  31. + File.open("foo", 'w') do |f|
  32. + assert_nothing_raised do
  33. + f.advise(:normal, 0, 0)
  34. + end
  35. + end
  36. + end
  37. + end
  38. end