| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  | require "testing_env" | 
					
						
							|  |  |  | require "tmpdir" | 
					
						
							|  |  |  | require "extend/pathname" | 
					
						
							|  |  |  | require "install_renamed" | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-26 22:02:14 -04:00
										 |  |  | module PathnameTestExtension | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   include FileUtils | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def setup | 
					
						
							| 
									
										
										
										
											2015-04-28 22:37:27 -04:00
										 |  |  |     @src  = Pathname.new(mktmpdir) | 
					
						
							|  |  |  |     @dst  = Pathname.new(mktmpdir) | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     @file = @src/"foo" | 
					
						
							|  |  |  |     @dir  = @src/"bar" | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def teardown | 
					
						
							|  |  |  |     rmtree(@src) | 
					
						
							|  |  |  |     rmtree(@dst) | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2015-03-26 22:02:14 -04:00
										 |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class PathnameTests < Homebrew::TestCase | 
					
						
							|  |  |  |   include PathnameTestExtension | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |   def test_disk_usage_extension | 
					
						
							|  |  |  |     mkdir_p @dir/"a-directory" | 
					
						
							|  |  |  |     touch @dir/".DS_Store" | 
					
						
							|  |  |  |     touch @dir/"a-file" | 
					
						
							|  |  |  |     File.truncate(@dir/"a-file", 1048576) | 
					
						
							|  |  |  |     ln_s @dir/"a-file", @dir/"a-symlink" | 
					
						
							|  |  |  |     ln @dir/"a-file", @dir/"a-hardlink" | 
					
						
							|  |  |  |     assert_equal 3, @dir.file_count | 
					
						
							|  |  |  |     assert_equal "3 files, 1M", @dir.abv | 
					
						
							|  |  |  |     assert_equal "1M", (@dir/"a-file").abv | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   def test_rmdir_if_possible | 
					
						
							|  |  |  |     mkdir_p @dir | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     touch @dir/"foo" | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     assert !@dir.rmdir_if_possible | 
					
						
							| 
									
										
										
										
											2014-06-11 12:21:03 -05:00
										 |  |  |     assert_predicate @dir, :directory? | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     rm_f @dir/"foo" | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |     assert @dir.rmdir_if_possible | 
					
						
							| 
									
										
										
										
											2014-06-11 12:21:03 -05:00
										 |  |  |     refute_predicate @dir, :exist? | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-05 22:04:59 -07:00
										 |  |  |   def test_rmdir_if_possible_ignore_ds_store | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |     mkdir_p @dir | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     touch @dir/".DS_Store" | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |     assert @dir.rmdir_if_possible | 
					
						
							| 
									
										
										
										
											2014-06-11 12:21:03 -05:00
										 |  |  |     refute_predicate @dir, :exist? | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_write | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |     @file.write("CONTENT") | 
					
						
							|  |  |  |     assert_equal "CONTENT", File.read(@file) | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_write_does_not_overwrite | 
					
						
							|  |  |  |     touch @file | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |     assert_raises(RuntimeError) { @file.write("CONTENT") } | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-16 19:08:56 +00:00
										 |  |  |   def test_append_lines | 
					
						
							|  |  |  |     touch @file | 
					
						
							|  |  |  |     @file.append_lines("CONTENT") | 
					
						
							|  |  |  |     assert_equal "CONTENT\n", File.read(@file) | 
					
						
							|  |  |  |     @file.append_lines("CONTENTS") | 
					
						
							|  |  |  |     assert_equal "CONTENT\nCONTENTS\n", File.read(@file) | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_append_lines_does_not_create | 
					
						
							|  |  |  |     assert_raises(RuntimeError) { @file.append_lines("CONTENT") } | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   def test_atomic_write | 
					
						
							|  |  |  |     touch @file | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |     @file.atomic_write("CONTENT") | 
					
						
							|  |  |  |     assert_equal "CONTENT", File.read(@file) | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-03-22 10:20:39 -05:00
										 |  |  |   def test_atomic_write_preserves_permissions | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |     File.open(@file, "w", 0100777) {} | 
					
						
							| 
									
										
										
										
											2014-03-22 10:20:39 -05:00
										 |  |  |     @file.atomic_write("CONTENT") | 
					
						
							|  |  |  |     assert_equal 0100777 & ~File.umask, @file.stat.mode | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_atomic_write_preserves_default_permissions | 
					
						
							|  |  |  |     @file.atomic_write("CONTENT") | 
					
						
							|  |  |  |     sentinel = @file.parent.join("sentinel") | 
					
						
							|  |  |  |     touch sentinel | 
					
						
							|  |  |  |     assert_equal sentinel.stat.mode, @file.stat.mode | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   def test_ensure_writable | 
					
						
							|  |  |  |     touch @file | 
					
						
							|  |  |  |     chmod 0555, @file | 
					
						
							| 
									
										
										
										
											2014-06-11 12:21:03 -05:00
										 |  |  |     @file.ensure_writable { assert_predicate @file, :writable? } | 
					
						
							|  |  |  |     refute_predicate @file, :writable? | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_extname | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |     assert_equal ".tar.gz", Pathname("foo-0.1.tar.gz").extname | 
					
						
							|  |  |  |     assert_equal ".cpio.gz", Pathname("foo-0.1.cpio.gz").extname | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_stem | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |     assert_equal "foo-0.1", Pathname("foo-0.1.tar.gz").stem | 
					
						
							|  |  |  |     assert_equal "foo-0.1", Pathname("foo-0.1.cpio.gz").stem | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_install_missing_file | 
					
						
							| 
									
										
										
										
											2014-07-10 21:26:54 -05:00
										 |  |  |     assert_raises(Errno::ENOENT) { @dst.install "non_existent_file" } | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_install_removes_original | 
					
						
							|  |  |  |     touch @file | 
					
						
							| 
									
										
										
										
											2013-08-12 20:55:24 -07:00
										 |  |  |     @dst.install(@file) | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-11 12:21:03 -05:00
										 |  |  |     assert_predicate @dst/@file.basename, :exist? | 
					
						
							|  |  |  |     refute_predicate @file, :exist? | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  |   def test_install_creates_intermediate_directories | 
					
						
							|  |  |  |     touch @file | 
					
						
							|  |  |  |     refute_predicate @dir, :directory? | 
					
						
							|  |  |  |     @dir.install(@file) | 
					
						
							|  |  |  |     assert_predicate @dir, :directory? | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_install_renamed | 
					
						
							| 
									
										
										
										
											2015-03-26 22:02:14 -04:00
										 |  |  |     @dst.extend(InstallRenamed) | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     @file.write "a" | 
					
						
							| 
									
										
										
										
											2015-03-26 22:02:14 -04:00
										 |  |  |     @dst.install @file | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  |     @file.write "b" | 
					
						
							| 
									
										
										
										
											2015-03-26 22:02:14 -04:00
										 |  |  |     @dst.install @file | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_equal "a", File.read(@dst/@file.basename) | 
					
						
							|  |  |  |     assert_equal "b", File.read(@dst/"#{@file.basename}.default") | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2015-03-26 22:02:15 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def test_install_renamed_directory | 
					
						
							|  |  |  |     @dst.extend(InstallRenamed) | 
					
						
							|  |  |  |     @file.write "a" | 
					
						
							|  |  |  |     @dst.install @src | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_equal "a", File.read(@dst/@src.basename/@file.basename) | 
					
						
							| 
									
										
										
										
											2015-03-26 22:02:15 -04:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2015-03-26 22:02:15 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-07 15:11:00 +00:00
										 |  |  |   def test_install_renamed_directory_recursive | 
					
						
							|  |  |  |     @dst.extend(InstallRenamed) | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     (@dst/@dir.basename).mkpath | 
					
						
							|  |  |  |     (@dst/@dir.basename/"another_file").write "a" | 
					
						
							| 
									
										
										
										
											2016-03-07 15:11:00 +00:00
										 |  |  |     @dir.mkpath | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     (@dir/"another_file").write "b" | 
					
						
							| 
									
										
										
										
											2016-03-07 15:11:00 +00:00
										 |  |  |     @dst.install @dir | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_equal "b", File.read(@dst/@dir.basename/"another_file.default") | 
					
						
							| 
									
										
										
										
											2016-03-07 15:11:00 +00:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-26 22:02:15 -04:00
										 |  |  |   def test_cp_path_sub_file | 
					
						
							|  |  |  |     @file.write "a" | 
					
						
							|  |  |  |     @file.cp_path_sub @src, @dst | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_equal "a", File.read(@dst/"foo") | 
					
						
							| 
									
										
										
										
											2015-03-26 22:02:15 -04:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_cp_path_sub_directory | 
					
						
							|  |  |  |     @dir.mkpath | 
					
						
							|  |  |  |     @dir.cp_path_sub @src, @dst | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_predicate @dst/@dir.basename, :directory? | 
					
						
							| 
									
										
										
										
											2015-03-26 22:02:15 -04:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  | end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-26 22:02:14 -04:00
										 |  |  | class PathnameInstallTests < Homebrew::TestCase | 
					
						
							|  |  |  |   include PathnameTestExtension | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  |   def setup | 
					
						
							|  |  |  |     super | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     (@src/"a.txt").write "This is sample file a." | 
					
						
							|  |  |  |     (@src/"b.txt").write "This is sample file b." | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_install | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     @dst.install @src/"a.txt" | 
					
						
							| 
									
										
										
										
											2015-03-25 21:11:51 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_predicate @dst/"a.txt", :exist?, "a.txt was not installed" | 
					
						
							|  |  |  |     refute_predicate @dst/"b.txt", :exist?, "b.txt was installed." | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_install_list | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     @dst.install [@src/"a.txt", @src/"b.txt"] | 
					
						
							| 
									
										
										
										
											2015-03-25 21:11:51 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_predicate @dst/"a.txt", :exist?, "a.txt was not installed" | 
					
						
							|  |  |  |     assert_predicate @dst/"b.txt", :exist?, "b.txt was not installed" | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_install_glob | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     @dst.install Dir[@src/"*.txt"] | 
					
						
							| 
									
										
										
										
											2015-03-25 21:11:51 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_predicate @dst/"a.txt", :exist?, "a.txt was not installed" | 
					
						
							|  |  |  |     assert_predicate @dst/"b.txt", :exist?, "b.txt was not installed" | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_install_directory | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     bin = @src/"bin" | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  |     bin.mkpath | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     mv Dir[@src/"*.txt"], bin | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  |     @dst.install bin | 
					
						
							| 
									
										
										
										
											2015-03-25 21:11:51 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_predicate @dst/"bin/a.txt", :exist?, "a.txt was not installed" | 
					
						
							|  |  |  |     assert_predicate @dst/"bin/b.txt", :exist?, "b.txt was not installed" | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_install_rename | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     @dst.install @src/"a.txt" => "c.txt" | 
					
						
							| 
									
										
										
										
											2015-03-25 21:11:51 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_predicate @dst/"c.txt", :exist?, "c.txt was not installed" | 
					
						
							|  |  |  |     refute_predicate @dst/"a.txt", :exist?, "a.txt was installed but not renamed" | 
					
						
							|  |  |  |     refute_predicate @dst/"b.txt", :exist?, "b.txt was installed" | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_install_rename_more | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     @dst.install(@src/"a.txt" => "c.txt", @src/"b.txt" => "d.txt") | 
					
						
							| 
									
										
										
										
											2015-03-25 21:11:51 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_predicate @dst/"c.txt", :exist?, "c.txt was not installed" | 
					
						
							|  |  |  |     assert_predicate @dst/"d.txt", :exist?, "d.txt was not installed" | 
					
						
							|  |  |  |     refute_predicate @dst/"a.txt", :exist?, "a.txt was installed but not renamed" | 
					
						
							|  |  |  |     refute_predicate @dst/"b.txt", :exist?, "b.txt was installed but not renamed" | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_install_rename_directory | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     bin = @src/"bin" | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  |     bin.mkpath | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     mv Dir[@src/"*.txt"], bin | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  |     @dst.install bin => "libexec" | 
					
						
							| 
									
										
										
										
											2015-03-25 21:11:51 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     refute_predicate @dst/"bin", :exist?, "bin was installed but not renamed" | 
					
						
							|  |  |  |     assert_predicate @dst/"libexec/a.txt", :exist?, "a.txt was not installed" | 
					
						
							|  |  |  |     assert_predicate @dst/"libexec/b.txt", :exist?, "b.txt was not installed" | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def test_install_symlink | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     bin = @src/"bin" | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  |     bin.mkpath | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     mv Dir[@src/"*.txt"], bin | 
					
						
							| 
									
										
										
										
											2015-03-25 21:37:26 -04:00
										 |  |  |     @dst.install_symlink bin | 
					
						
							| 
									
										
										
										
											2014-03-18 19:03:25 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_predicate @dst/"bin", :symlink? | 
					
						
							|  |  |  |     assert_predicate @dst/"bin", :directory? | 
					
						
							|  |  |  |     assert_predicate @dst/"bin/a.txt", :exist? | 
					
						
							|  |  |  |     assert_predicate @dst/"bin/b.txt", :exist? | 
					
						
							|  |  |  |     assert_predicate((@dst/"bin").readlink, :relative?) | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2015-05-21 20:43:38 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def test_install_relative_symlink | 
					
						
							|  |  |  |     @dst.install_symlink "foo" => "bar" | 
					
						
							| 
									
										
										
										
											2016-04-01 11:08:29 +08:00
										 |  |  |     assert_equal Pathname.new("foo"), (@dst/"bar").readlink | 
					
						
							| 
									
										
										
										
											2015-05-21 20:43:38 -04:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2013-04-10 15:02:45 -05:00
										 |  |  | end |