Sha256: 56a4bf94efee73f24738168912514a200a08930fefe069d9c04e84a8e1c3449b

Contents?: true

Size: 642 Bytes

Versions: 6

Compression:

Stored size: 642 Bytes

Contents

# frozen_string_literal: true

require 'gir_ffi_test_helper'

describe GirFFI::InfoExt::SafeConstantName do
  let(:info_class) do
    Class.new do
      include GirFFI::InfoExt::SafeConstantName
    end
  end
  let(:info) { info_class.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

6 entries across 6 versions & 1 rubygems

Version Path
gir_ffi-0.14.1 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.14.0 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.13.1 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.13.0 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.12.1 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.12.0 test/gir_ffi/info_ext/safe_constant_name_test.rb