Sha256: 4c72b901b1a1ed1d761d87d74fc72cc3d57cc76bd5757aa2b72b158e7242e3bd

Contents?: true

Size: 601 Bytes

Versions: 10

Compression:

Stored size: 601 Bytes

Contents

require 'gir_ffi_test_helper'

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

10 entries across 10 versions & 1 rubygems

Version Path
gir_ffi-0.9.2 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.9.1 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.9.0 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.8.6 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.8.5 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.8.4 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.8.3 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.8.2 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.8.1 test/gir_ffi/info_ext/safe_constant_name_test.rb
gir_ffi-0.8.0 test/gir_ffi/info_ext/safe_constant_name_test.rb