Commits

Anonymous committed 56638b0

initial test for add command

Comments (0)

Files changed (1)

t/Hg/Lib/Client/add.t

+#! perl
+
+
+use Test::Roo;
+
+use Test::Lib;
+
+use Test::Hg::Lib::Exec;
+
+with 'Test::Hg::Lib::Role::Client';
+with 'Test::Hg::Lib::Role::BasicRepo';
+with 'Test::Hg::Lib::Role::TempDir';
+
+use DDP;
+
+test add => sub {
+
+    my $self = shift;
+
+    my $res = $self->client->add( 'a' );
+
+    is( $res->ret, 0, "add existing file" );
+
+    my $status = xhg( 'status' );
+
+    is_deeply(
+        $status,
+        {
+            a => 'A',
+            b => '?',
+            c => '?'
+        },
+        'consistent status'
+    );
+
+};
+
+test add_non_existent => sub {
+
+    my $self = shift;
+
+    my $res = $self->client->add( 'a2' );
+
+    isnt( $res->ret, 0, "add non-existing file" );
+
+    my $status = xhg( 'status' );
+
+    is_deeply(
+        $status,
+        {
+            a => '?',
+            b => '?',
+            c => '?'
+        },
+        'consistent status'
+    );
+
+};
+
+run_me;
+done_testing;