mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
ruby: tests: isolate boilerplate in common file
Isolate in a common file all the standard boilerplate in tests, i.e. the import of the test framework and the guestfs module (including the import path hack needed for the latter). Thanks to Vít Ondruch for the precious hints and suggestions.
This commit is contained in:
@@ -29,7 +29,8 @@ EXTRA_DIST = \
|
||||
lib/guestfs.rb \
|
||||
run-bindtests \
|
||||
run-ruby-tests \
|
||||
t/tc_*.rb
|
||||
t/tc_*.rb \
|
||||
t/test_helper.rb
|
||||
|
||||
CLEANFILES = \
|
||||
lib/*~ \
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def test_load
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def test_create
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# libguestfs Ruby bindings -*- ruby -*-
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
# Copyright (C) 2013-2014 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -15,10 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def test_create_flags
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# libguestfs Ruby bindings -*- ruby -*-
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
# Copyright (C) 2013-2014 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -15,10 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def test_create_multiple
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# libguestfs Ruby bindings -*- ruby -*-
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
# Copyright (C) 2013-2014 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -15,10 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def test_handle_properties
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# libguestfs Ruby bindings -*- ruby -*-
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
# Copyright (C) 2013-2014 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -15,10 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def test_explicit_close
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# libguestfs Ruby bindings -*- ruby -*-
|
||||
# Copyright (C) 2010 Red Hat Inc.
|
||||
# Copyright (C) 2010-2014 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -15,10 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def test_optargs
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def test_launch
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def test_events
|
||||
|
||||
@@ -15,10 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def test_events
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# libguestfs Ruby bindings -*- ruby -*-
|
||||
# Copyright (C) 2009 Red Hat Inc.
|
||||
# Copyright (C) 2009-2014 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -15,10 +15,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def test_rhbz507346
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# libguestfs Ruby bindings -*- ruby -*-
|
||||
# Copyright (C) 2011 Red Hat Inc.
|
||||
# Copyright (C) 2011-2014 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -19,10 +19,7 @@
|
||||
# the interpreter to segfault. See:
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=664558#c6
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def test_rhbz664558c6
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# libguestfs Ruby bindings -*- ruby -*-
|
||||
# Copyright (C) 2013 Red Hat Inc.
|
||||
# Copyright (C) 2013-2014 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@@ -18,10 +18,7 @@
|
||||
# Test that we don't break the old ::create module function while
|
||||
# fixing https://bugzilla.redhat.com/show_bug.cgi?id=1046509
|
||||
|
||||
require 'test/unit'
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
require File::join(File::dirname(__FILE__), 'test_helper')
|
||||
|
||||
class TestLoad < Test::Unit::TestCase
|
||||
def _handleok(g)
|
||||
|
||||
22
ruby/t/test_helper.rb
Normal file
22
ruby/t/test_helper.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
# libguestfs Ruby bindings -*- ruby -*-
|
||||
# Copyright (C) 2009-2014 Red Hat Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
require 'test/unit'
|
||||
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "lib"))
|
||||
$:.unshift(File::join(File::dirname(__FILE__), "..", "ext", "guestfs"))
|
||||
require 'guestfs'
|
||||
Reference in New Issue
Block a user