~ubuntu-branches/ubuntu/trusty/ruby-curb/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/bug_postfields_crash2.rb

  • Committer: Package Import Robot
  • Author(s): Praveen Arimbrathodiyil
  • Date: 2013-05-15 23:07:43 UTC
  • Revision ID: package-import@ubuntu.com-20130515230743-0d8zw826n6hjrk55
Tags: upstream-0.8.3
ImportĀ upstreamĀ versionĀ 0.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Not sure if this is an IRB bug, but thought you guys should know.
 
2
#
 
3
# ** My Ruby version: ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]
 
4
# ** Version of Rubygems: 1.3.5
 
5
# ** Version of the Curb gem: 0.6.6.0
 
6
#
 
7
#
 
8
# Transcript of IRB session:
 
9
# ------------------------------------------------------------------------------------------------------------------
 
10
# irb(main):001:0>  a =  {
 
11
# irb(main):002:1*     :type => :pie,
 
12
# irb(main):003:1*     :series => {
 
13
# irb(main):004:2*       :names => [:a,:b],
 
14
# irb(main):005:2*       :values => [70,30],
 
15
# irb(main):006:2*       :colors => [:red,:green]
 
16
# irb(main):007:2>     },
 
17
# irb(main):008:1*     :output_format => :png
 
18
# irb(main):009:1>   }
 
19
# => {:type=>:pie, :output_format=>:png, :series=>{:names=>[:a, :b], :values=>[70, 30], :colors=>[:red, :green]}}
 
20
# irb(main):010:0> post = []
 
21
# => []
 
22
# irb(main):011:0> require 'rubygems'
 
23
# => true
 
24
# irb(main):012:0> require 'curb'
 
25
# => true
 
26
# irb(main):013:0> include Curl
 
27
# => Object
 
28
# irb(main):014:0> a.each_pair do |k,v|
 
29
# irb(main):015:1* post << PostField.content(k,v)
 
30
# irb(main):016:1> end
 
31
# => {:type=>:pie, :output_format=>:png, :series=>{:names=>[:a, :b], :values=>[70, 30], :colors=>[:red, :green]}}
 
32
# irb(main):017:0> post
 
33
# /usr/lib/ruby/1.8/irb.rb:302: [BUG] Segmentation fault
 
34
# ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]
 
35
#
 
36
# Aborted
 
37
# ------------------------------------------------------------------------------------------------------------------
 
38
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
 
39
 
 
40
class BugPostFieldsCrash2 < Test::Unit::TestCase
 
41
  def test_crash
 
42
    a =  {
 
43
       :type => :pie,
 
44
       :series => {
 
45
         :names => [:a,:b],
 
46
         :values => [70,30],
 
47
         :colors => [:red,:green]
 
48
       },
 
49
       :output_format => :png
 
50
    }
 
51
    post = []
 
52
    a.each_pair do |k,v|
 
53
      post << Curl::PostField.content(k,v)
 
54
    end
 
55
    post.inspect
 
56
  end
 
57
end