Sha256: efc7b8629892686f757e1bf7a6c5bcf3aebdd7765550ebacd3a4099e9a63840c

Contents?: true

Size: 598 Bytes

Versions: 2

Compression:

Stored size: 598 Bytes

Contents

require 'gir_ffi_test_helper'

describe GirFFI::InfoExt::SafeConstantName do
  let(:klass) {
    Class.new do
      include GirFFI::InfoExt::SafeConstantName
    end
  }
  let(:info) { klass.new }

  describe '#safe_name' do
    it 'makes names starting with an underscore safe' do
      expect(info).to receive(:name).and_return '_foo'

      assert_equal 'Private___foo', info.safe_name
    end

    it 'makes names with dashes safe' do
      expect(info).to receive(:name).and_return 'this-could-be-a-signal-name'

      info.safe_name.must_equal 'This_could_be_a_signal_name'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gir_ffi-0.7.10 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.7.9 test/gir_ffi/info_ext/safe_constant_name_test.rb