Rubyspec y el largo camino hacia Ruby 1.9

999 views

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
999
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • MSpec is a specialized framework that is syntax-compatible with RSpec for basic things like describe, it blocks and before, after actions.
    MSpec contains additional features that assist in writing the RubySpecs used by multiple Ruby implementations. Also, MSpec attempts to use the simplest Ruby language features so that beginning Ruby implementations can run it.
  • EL PRIMERO ES EL EXTERNAL

    AL LEER EL FICHERO LO TRADUCE AUTOMATICAMENTE
  • Rubyspec y el largo camino hacia Ruby 1.9

    1. 1. Rubyspec y el largo camino hacia Ruby 1.9 David Calavera
    2. 2. Convención Ruby == generalización Ruby 1.9 == implementación
    3. 3. Acceptance Testing
    4. 4. Acceptance Testing como especificación
    5. 5. ¿este modelo es válido para desarrollar un lenguaje?
    6. 6. ¿este modelo es válido para copiar un lenguaje?
    7. 7. ¿podemos usar la documentación como especificación?
    8. 8. NO
    9. 9. File.new(‘hello.rb’)
    10. 10. -------------------------------------------------------------- File::new File.new(filename, mode="r") => file File.new(filename [, mode [, perm]]) => file ------------------------------------------------------------------------ Opens the file named by _filename_ according to _mode_ (default is ``r'') and returns a new +File+ object. See the description of class +IO+ for a description of _mode_. The file mode may optionally be specified as a +Fixnum+ by _or_-ing together the flags (O_RDONLY etc, again described under +IO+). Optional permission bits may be given in _perm_. These mode and permission bits are platform dependent; on Unix systems, see +open(2)+ for details. f = File.new("testfile", "r") f = File.new("newfile", "w+") f = File.new("newfile", File::CREAT|File::TRUNC|File::RDWR, 0644)
    11. 11. ruby 1.8.8dev (2009-11-19 revision 25863) [i386-darwin9.8.0] File.new - returns a new File with mode string - returns a new File with mode num - returns a new File with modus num and permissions - creates the file and returns writable descriptor when called with 'w' mode and r-o permissions - opens the existing file, does not change permissions even when they are specified - returns a new File with modus fd - creates a new file when use File::EXCL mode - raises an Errorno::EEXIST if the file exists when create a new file with File::CREAT|File::EXCL - creates a new file when use File::WRONLY|File::APPEND mode - raises an Errno::EINVAL error with File::RDONLY|File::WRONLY - creates a new file when use File::WRONLY|File::TRUNC mode - coerces filename using to_str - raises a TypeError if the first parameter can't be coerced to string - raises a TypeError if the first parameter is nil - raises an Errno::EBADF if the first parameter is an invalid file descriptor - raises an ArgumentError when it receives more than three parameters - opens directories Finished in 0.025401 seconds 1 file, 17 examples, 32 expectations, 0 failures, 0 errors
    12. 12. Rubyspec
    13. 13. “Rubyspec is a project to write a complete, executable specification for the Ruby programming language.”
    14. 14. Necesidad tener una definición del lenguaje razonablemente precisa
    15. 15. Necesidad dejar de hacer ingeniería inversa
    16. 16. Meta dejar de pensar sobre qué implementación corre nuestro código
    17. 17. Ruby JRuby Rubinius IronRuby MacRuby
    18. 18. Ruby JRuby Rubinius IronRuby MacRuby
    19. 19. Mspec + Rubyspec
    20. 20. Mspec mspec core/file/new_spec.rb
    21. 21. Mspec ruby_version_is "1.9" do ruby_version_is "1.8.7" do ruby_version_is "".."1.9" do
    22. 22. Mspec platform_is :windows do platform_is_not :windows do platform_is :darwin, :java do platform_is :wordsize => 32 do
    23. 23. Mspec compilant_on :jruby do not_compilant_on :rubinius do not_supported_on :jruby do deviates_on :ironruby do extended_on :macruby do
    24. 24. Mspec runner_is :mspec do conflicts_with :SomeClass do as_superuser do
    25. 25. Mspec quarantine! do ruby_bug "#1582", "1.9.2" do
    26. 26. Mspec especificaciones compartidas configurable por versión especificaciones taggables
    27. 27. Rubyspec describe "File.new" do it "returns a new File with mode string" do @fh = File.new(@file, 'w') @fh.class.should == File File.exists?(@file).should == true end end
    28. 28. Rubyspec ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.8.0] 2854 files, 11483 examples, 36622 expectations, 20 failures, 12 errors ruby 1.9.2dev (2009-09-26 trunk 25102) [i386-darwin9.8.0] 2847 files, 13017 examples, 177090 expectations, 236 failures, 442 errors
    29. 29. El camino hacia 1.9
    30. 30. Cambios del lenguaje == Mantener varios parsers
    31. 31. Cambios del lenguaje {hoge: :fuga}
    32. 32. Cambios del lenguaje Proc.new{|&p|}
    33. 33. Cambios de jerarquía == Problemas de tipado
    34. 34. Cambios de jerarquía BasicObject
    35. 35. Cambios de jerarquía !String.include? Enumerable
    36. 36. Soporte de encoding == Reescribir IO
    37. 37. Soporte de encoding ‘ ’.encode!
    38. 38. Soporte de encoding default_external vs default_internal
    39. 39. Soporte de encoding File.open(‘file.txt’, ‘r:iso-8859-1:utf-8’)
    40. 40. Class coercion
    41. 41. Object coercion to_path
    42. 42. El camino recorrido
    43. 43. 100 75 50 25 0 IronRuby Rubinius JRuby MacRuby
    44. 44. ¿qué pasará cuando empiece el desarrollo de Ruby 2.0?
    45. 45. ¡¡¡Contribuye!!!
    46. 46. ¡Gracias! www.rubyspec.org www.thinkincode.net @calavera calavera@apache.org
    47. 47. Fotos http://www.flickr.com/photos/katgloor/3652188896/ http://www.flickr.com/photos/carowallis1/328329703/ http://www.flickr.com/photos/simpologist/46161407/ http://www.flickr.com/photos/nicmcphee/250890495/

    ×