~ubuntu-branches/ubuntu/trusty/ruby1.9/trusty

« back to all changes in this revision

Viewing changes to test/fileutils/test_nowrite.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2006-05-08 22:23:12 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060508222312-w2wqeaz030ifi59j
Tags: 1.9.0+20060423-3ubuntu1
* Resynchronized with Debian.
* Only change from Debian is the addition of
  debian/patches/903_sparc_fix_define.patch to fix illegal instructions
  at runtime on sparc. (change from 1.9.0+20050921-1ubuntu1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# test/fileutils/test_nowrite.rb
3
 
#
 
1
# $Id: test_nowrite.rb,v 1.6 2005/09/23 23:30:09 aamine Exp $
4
2
 
5
3
require 'fileutils'
6
4
require 'fileasserts'
7
5
require 'tmpdir'
8
6
require 'test/unit'
9
7
 
10
 
 
11
 
class TestNoWrite < Test::Unit::TestCase
 
8
class TestFileUtilsNoWrite < Test::Unit::TestCase
12
9
 
13
10
  include FileUtils::NoWrite
14
11
 
15
 
  def my_rm_rf( path )
 
12
  def test_visibility
 
13
    FileUtils::METHODS.each do |m|
 
14
      assert_equal true, FileUtils::NoWrite.respond_to?(m, true),
 
15
                   "FileUtils::NoWrite.#{m} is not defined"
 
16
      assert_equal true, FileUtils::NoWrite.respond_to?(m, false),
 
17
                   "FileUtils::NoWrite.#{m} is not public"
 
18
    end
 
19
    FileUtils::METHODS.each do |m|
 
20
      assert_equal true, respond_to?(m, true),
 
21
                   "FileUtils::NoWrite\##{m} is not defined"
 
22
      assert_equal true, FileUtils::NoWrite.private_method_defined?(m),
 
23
                   "FileUtils::NoWrite\##{m} is not private"
 
24
    end
 
25
  end
 
26
 
 
27
  def my_rm_rf(path)
16
28
    if File.exist?('/bin/rm')
17
29
      system %Q[/bin/rm -rf "#{path}"]
18
30
    else
50
62
    check 'tmp/mv'
51
63
  end
52
64
 
53
 
  def check( dest )
 
65
  def check(dest)
54
66
    assert_file_not_exist dest
55
67
    assert_file_exist SRC
56
68
    assert_same_file SRC, COPY