Next Automated Testing 15

For example...

        print "# get and set nonexistent user\n";
        my $nosuch = $db->get_user('nosuchuser');
        ok($nosuch, "no such user");
        is($nosuch->start, time(), "default start time for nonexistent user");
        is($nosuch->level, "x", "default level for nonexistent user");
        is($nosuch->expire, 28, "default expire time for nonexistent user");
        is($nosuch->expire(13), 28, "default expire time for nonexistent user - set");
        ok($db->put_user($nosuch), "write new user");
        chomp(@after = grep /^nosuchuser/, qx(cat $file));
        is(scalar(@after), 1, "added user to database");
        my @nosuch_after = split /:/, $after[0];
        is($nosuch_after[0], "nosuchuser", "new record username");
        is($nosuch_after[1], "x", "new record level");
        is($nosuch_after[4], 13, "new record expire");

Next Copyright © 2004 Mark Dominus