Sha256: 4a6e9399db175b4c457829b7307f0ce38812316aaa6743811710988c55864d79

Contents?: true

Size: 732 Bytes

Versions: 3

Compression:

Stored size: 732 Bytes

Contents

require 'gir_ffi_test_helper'

require 'tempfile'

GirFFI.setup :Regress

describe "Pretty-printing" do
  def assert_syntax_ok str
    tmp = Tempfile.new "gir_ffi"
    # TODO: Make #pretty_print add this preamble.
    tmp.write "# coding: utf-8\n"
    tmp.write str
    tmp.flush
    is_ok = `ruby -c #{tmp.path} 2>&1`
    is_ok.must_match(/^Syntax OK/)
  end

  describe "for the Regress module" do
    it "runs without throwing an exception" do
      Regress._builder.pretty_print
    end

    it "results in valid Ruby" do
      assert_syntax_ok Regress._builder.pretty_print
    end
  end

  describe "for the GLib module" do
    it "results in valid Ruby" do
      assert_syntax_ok GLib._builder.pretty_print
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gir_ffi-0.4.3 test/integration/pretty_print_test.rb
gir_ffi-0.4.2 test/integration/pretty_print_test.rb
gir_ffi-0.4.1 test/integration/pretty_print_test.rb