| 1 | #!/usr/bin/perl |
|---|
| 2 | # $Id$ |
|---|
| 3 | use strict; |
|---|
| 4 | use warnings; |
|---|
| 5 | use lib 't/lib', 'extlib', 'lib', '../lib', '../extlib'; |
|---|
| 6 | use Test::More tests => 13; |
|---|
| 7 | |
|---|
| 8 | use MT; |
|---|
| 9 | use MT::FileMgr; |
|---|
| 10 | |
|---|
| 11 | my $File = 'test.file'; |
|---|
| 12 | my $String = 'testing'; |
|---|
| 13 | |
|---|
| 14 | my $fmgr = MT::FileMgr->new('Local'); |
|---|
| 15 | isa_ok($fmgr, 'MT::FileMgr'); |
|---|
| 16 | ok($fmgr->can_write('.'), 'can_write'); |
|---|
| 17 | ok($fmgr->content_is_updated($File, \$String), "content_is_updated($File,$String)"); |
|---|
| 18 | |
|---|
| 19 | ok($fmgr->put_data($String, $File), "put_data($String, $File)"); |
|---|
| 20 | ok(!$fmgr->content_is_updated($File, \$String), "content_is_updated($File,$String)"); |
|---|
| 21 | my $str2 = $String . 'bar'; |
|---|
| 22 | ok($fmgr->content_is_updated($File, \$str2), "content_is_updated($File,$str2)"); |
|---|
| 23 | ok($str2, $String . 'bar'); |
|---|
| 24 | |
|---|
| 25 | my($copy) = $String = "bjæ·¡rn"; |
|---|
| 26 | ok($fmgr->put_data($String, $File), "put_data($String, $File)"); |
|---|
| 27 | ok(!$fmgr->content_is_updated($File, \$String), "content_is_updated($File,$String)"); |
|---|
| 28 | is($copy, $String, "$copy is $String"); |
|---|
| 29 | |
|---|
| 30 | ok(-f $File, "$File is a regular file"); |
|---|
| 31 | ok($fmgr->delete($File), "delete($File)"); |
|---|
| 32 | ok(!-f $File, "$File is gone"); |
|---|