| 1 |
use Test2::Bundle::Extended -target => 'Test2::Harness::Util::File::JSON'; |
| 2 |
# HARNESS-DURATION-SHORT |
| 3 |
|
| 4 |
use ok $CLASS; |
| 5 |
|
| 6 |
isa_ok($CLASS, 'Test2::Harness::Util::File'); |
| 7 |
|
| 8 |
my $one = $CLASS->new(name => 'fake'); |
| 9 |
|
| 10 |
is($one->decode('{"a":1}'), {a => 1}, "decode will decode json"); |
| 11 |
is($one->encode({}), "{}", "encode will encode json"); |
| 12 |
|
| 13 |
like( |
| 14 |
dies { $one->reset }, |
| 15 |
qr/line reading is disabled for json files/, |
| 16 |
"Got expected exception for reset()" |
| 17 |
); |
| 18 |
|
| 19 |
like( |
| 20 |
dies { $one->read_line }, |
| 21 |
qr/line reading is disabled for json files/, |
| 22 |
"Got expected exception for read_line()" |
| 23 |
); |
| 24 |
|
| 25 |
done_testing; |