Sha256: c18b8db542412eaa1952d8e1706c5e234201c910aab09533fa612a906beec613

Contents?: true

Size: 831 Bytes

Versions: 4

Compression:

Stored size: 831 Bytes

Contents

require 'spec_helper'

require 'perl/ext/string'
require 'perl/interpreter'

describe String do
  describe "#to_perl" do
    before(:all) do
      @interpreter = Perl::Interpreter.new
    end
    after(:all) do
      @interpreter.stop
    end

    describe "on an empty String" do
      let(:subject) { "" }

      it "should return the expected result" do
        ptr = subject.to_perl
        ptr.should be_kind_of(FFI::Pointer)
        value = Perl::Value::Scalar.new(ptr)
        value.value.should == ""
      end
    end

    describe "on a String" do
      let(:subject) { "something" }

      it "should return the expected result" do
        ptr = subject.to_perl
        ptr.should be_kind_of(FFI::Pointer)
        value = Perl::Value::Scalar.new(ptr)
        value.value.should == "something"
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-perl-04.01.2011.2 spec/ext/string_spec.rb
ruby-perl-04.01.2011.1 spec/ext/string_spec.rb
ruby-perl-04.01.2011 spec/ext/string_spec.rb
ruby-perl-0.99.15j spec/ext/string_spec.rb