Sha256: 56efb092cace51c24e0247debc724057914788d8d1786f2be527ab4e7b92c3ca

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

require "ffi-win32-extensions"
require "test-unit"

class TC_FFI_Win32_Extensions < Test::Unit::TestCase
  def setup
    @ptr = FFI::MemoryPointer.new(:char)
  end

  test "read_array_of_strings" do
    assert_respond_to(@ptr, :read_array_of_string)
  end

  test "windows_error_message basic functionality" do
    assert_respond_to(FFI, :windows_error_message)
    assert_kind_of(String, FFI.windows_error_message("foo"))
  end

  test "windows_error_message returns the expected value" do
    expected = "foo: The operation completed successfully."
    assert_equal(expected, FFI.windows_error_message("foo", 0))
  end

  test "raise_windows_error" do
    assert_respond_to(FFI, :raise_windows_error)
  end

  test "read_wide_string basic functionality" do
    assert_respond_to(@ptr, :read_wide_string)
    assert_kind_of(String, @ptr.read_wide_string)
  end

  test "read_wide_string has optional argument" do
    assert_nothing_raised { @ptr.read_wide_string }
    assert_nothing_raised { @ptr.read_wide_string(@ptr.size) }
  end

  def teardown
    @ptr.free
    @ptr = nil
  end
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
fluent-plugin-nuopenlineage-light-0.1.0 vendor/bundle/ruby/3.3.0/gems/ffi-win32-extensions-1.0.4/test/test_ffi_extensions.rb
fluent-plugin-openlineage-light-0.1.4 vendor/bundle/ruby/3.3.0/gems/ffi-win32-extensions-1.0.4/test/test_ffi_extensions.rb
fluent-plugin-openlineage-light-0.1.3 vendor/bundle/ruby/3.3.0/gems/ffi-win32-extensions-1.0.4/test/test_ffi_extensions.rb
fluent-plugin-openlineage-0.1.0 vendor/bundle/ruby/3.3.0/gems/ffi-win32-extensions-1.0.4/test/test_ffi_extensions.rb
ffi-win32-extensions-1.0.4 test/test_ffi_extensions.rb