<commit_before># frozen_string_literal: true

require 'gir_ffi_test_helper'

describe 'The generated WarnLib module' do
  before do
    begin
      GirFFI.setup :WarnLib
    rescue RuntimeError
      skip 'WarnLib GIR not available'
    end
  end

  describe 'WarnLib::Whatever' do
    let(:derived_klass) do
      Object.const_set("DerivedClass#{Sequence.next}", Class.new(GObject::Object))
    end

    before do
      @result = nil
      derived_klass.class_eval { include WarnLib::Whatever }
      GirFFI.define_type derived_klass do |info|
        info.install_vfunc_implementation :do_boo, proc { |_obj, x, _y| @result = "boo#{x}" }
        info.install_vfunc_implementation :do_moo, proc { |_obj, x, _y| @result = "moo#{x}" }
      end
    end

    let(:instance) { derived_klass.new }

    it 'has a working method #do_boo' do
      instance.do_boo 42, nil
      @result.must_equal 'boo42'
    end

    it 'has a working method #do_moo' do
      instance.do_moo 23, nil
      @result.must_equal 'moo23'
    end
  end

  it 'has a working function #throw_unpaired' do
    proc { WarnLib.throw_unpaired }.must_raise GirFFI::GLibError
  end

  it 'has a working function #unpaired_error_quark' do
    result = WarnLib.unpaired_error_quark
    GLib.quark_to_string(result).must_equal 'warnlib-unpaired-error'
  end
end
<commit_msg>WarnLib should be available in supported versions<commit_after># frozen_string_literal: true

require 'gir_ffi_test_helper'

GirFFI.setup :WarnLib

describe 'The generated WarnLib module' do
  describe 'WarnLib::Whatever' do
    let(:derived_klass) do
      Object.const_set("DerivedClass#{Sequence.next}", Class.new(GObject::Object))
    end

    before do
      @result = nil
      derived_klass.class_eval { include WarnLib::Whatever }
      GirFFI.define_type derived_klass do |info|
        info.install_vfunc_implementation :do_boo, proc { |_obj, x, _y| @result = "boo#{x}" }
        info.install_vfunc_implementation :do_moo, proc { |_obj, x, _y| @result = "moo#{x}" }
      end
    end

    let(:instance) { derived_klass.new }

    it 'has a working method #do_boo' do
      instance.do_boo 42, nil
      @result.must_equal 'boo42'
    end

    it 'has a working method #do_moo' do
      instance.do_moo 23, nil
      @result.must_equal 'moo23'
    end
  end

  it 'has a working function #throw_unpaired' do
    proc { WarnLib.throw_unpaired }.must_raise GirFFI::GLibError
  end

  it 'has a working function #unpaired_error_quark' do
    result = WarnLib.unpaired_error_quark
    GLib.quark_to_string(result).must_equal 'warnlib-unpaired-error'
  end
end

{'fraction_non_alphanumeric': 0.09381007304882738, 'fraction_numerical': 0.006151480199923107, 'mean_word_length': 3.343906510851419, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3006180', 'n_tokens_mistral': 943, 'n_tokens_neox': 911, 'n_words': 226}