-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Array#pack with format "fFeEdDgG" will raise a TypeError when does no…
…t convert into float. Test Script: {{{ require 'test/unit/assertions.rb' include Test::Unit::Assertions assert_raise(TypeError){ ["a"].pack("f") } assert_raise(TypeError){ ["a"].pack("F") } assert_raise(TypeError){ ["a"].pack("e") } assert_raise(TypeError){ ["a"].pack("E") } assert_raise(TypeError){ ["a"].pack("d") } assert_raise(TypeError){ ["a"].pack("D") } assert_raise(TypeError){ ["a"].pack("g") } assert_raise(TypeError){ ["a"].pack("G") } class String def utf8 self.force_encoding('UTF-8') end end assert_equal("\x00\x00\x80?".utf8, [1.0].pack("f").utf8) assert_equal("\x00\x00\x80?".utf8, [1.0].pack("e").utf8) assert_equal("\x00\x00\x00\x00\x00\x00\xF0?".utf8, [1.0].pack("d").utf8) assert_equal("?\x80\x00\x00".utf8, [1.0].pack("g").utf8) puts :ok }}} git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@5169 23306eb0-4c56-4727-a40e-e92c0eb68959
- Loading branch information
1 parent
9595725
commit 8d12f25
Showing
3 changed files
with
21 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters