From 4a797aa1640db3a7c687c5971a7aaa761706e881 Mon Sep 17 00:00:00 2001 From: Mario Domgoergen Date: Mon, 22 Feb 2016 23:08:36 +0100 Subject: [PATCH] Add more tests for subcommands --- t/run.t | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/t/run.t b/t/run.t index 96d5e01..4af0380 100644 --- a/t/run.t +++ b/t/run.t @@ -34,9 +34,42 @@ like( $twtfile->slurp_utf8, qr/[\d:TZ-]+\tHello World/ ); stdout_is( sub { $app->run( 'follow', 'bob', '/bob.txt' ) }, qq{You're already following bob.\n} ); +stdout_is( + sub { $app->run( 'follow', 'bob', '/bob2.0.txt' ) }, + qq{You're already following bob under a differant url.\n} +); + stdout_is( sub { $app->run( 'unfollow', 'bob' ) }, qq{You've unfollowed bob.\n} ); +stdout_is( + sub { $app->run( 'unfollow', 'charlie' ) }, + qq{You're not following charlie.\n} +); + stdout_is( sub { $app->run('following') }, qq{alice @ /alice.txt\n} ); +stdout_is( sub { $app->run( 'follow', 'bob', '/bob.txt' ) }, + qq{You're now following bob.\n} ); + +stdout_is( + sub { $app->run( 'config', 'get', 'disclose_identity' ) }, + qq{The configuration key disclose_identity is unset.\n} +); + +ok( not exists $app->config->read_file->{twtxt}->{disclose_identity} ); + +stdout_is( sub { $app->run( 'config', 'set', 'disclose_identity', 1 ) }, qq{} ); + +is( $app->config->read_file->{twtxt}->{disclose_identity}, 1 ); + +stdout_is( sub { $app->run( 'config', 'get', 'disclose_identity' ) }, qq{1\n} ); + +stdout_is( sub { $app->run( 'config', 'remove', 'disclose_identity' ) }, qq{} ); + +stdout_is( + sub { $app->run( 'config', 'get', 'disclose_identity' ) }, + qq{The configuration key disclose_identity is unset.\n} +); + done_testing;