Changeset 12641 for trunk/Nebulous-Server/t/06_server_unlock_object.t
- Timestamp:
- Mar 28, 2007, 11:41:11 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous-Server/t/06_server_unlock_object.t (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/t/06_server_unlock_object.t
r10546 r12641 3 3 # Copryight (C) 2004-2005 Joshua Hoblitt 4 4 # 5 # $Id: 06_server_unlock_object.t,v 1. 6 2006-12-08 03:29:19jhoblitt Exp $5 # $Id: 06_server_unlock_object.t,v 1.7 2007-03-28 21:41:11 jhoblitt Exp $ 6 6 7 7 use strict; … … 25 25 26 26 { 27 $neb->create_object( "foo");27 $neb->create_object("foo"); 28 28 29 $neb->lock_object( "foo", "read");29 $neb->lock_object("foo", "read"); 30 30 31 ok( $neb->unlock_object( "foo", "read" ), "read unlock");31 ok($neb->unlock_object("foo", "read"), "read unlock"); 32 32 } 33 33 … … 35 35 36 36 { 37 $neb->create_object( "foo");37 $neb->create_object("foo"); 38 38 39 $neb->lock_object( "foo", "read");40 $neb->lock_object( "foo", "read");39 $neb->lock_object("foo", "read"); 40 $neb->lock_object("foo", "read"); 41 41 42 ok( $neb->unlock_object( "foo", "read" ), "read unlock");43 ok( $neb->unlock_object( "foo", "read" ), "read unlock");42 ok($neb->unlock_object("foo", "read"), "read unlock"); 43 ok($neb->unlock_object("foo", "read"), "read unlock"); 44 44 } 45 45 … … 47 47 48 48 { 49 $neb->create_object( "foo");49 $neb->create_object("foo"); 50 50 51 $neb->lock_object( "foo", "write");51 $neb->lock_object("foo", "write"); 52 52 53 ok( $neb->unlock_object( "foo", "write" ), "write unlock");53 ok($neb->unlock_object("foo", "write"), "write unlock"); 54 54 } 55 55 … … 57 57 58 58 eval { 59 $neb->unlock_object( "foo", "read");59 $neb->unlock_object("foo", "read"); 60 60 }; 61 like( $@, qr/storage object does not exist/, "storage object does not exist");61 like($@, qr/storage object does not exist/, "storage object does not exist"); 62 62 63 63 Test::Nebulous->setup; 64 64 65 65 eval { 66 $neb->unlock_object( "foo", "write");66 $neb->unlock_object("foo", "write"); 67 67 }; 68 like( $@, qr/storage object does not exist/, "storage object does not exist");68 like($@, qr/storage object does not exist/, "storage object does not exist"); 69 69 70 70 Test::Nebulous->setup; 71 71 72 72 eval { 73 $neb->create_object( "foo");73 $neb->create_object("foo"); 74 74 75 $neb->unlock_object( "foo", "read");75 $neb->unlock_object("foo", "read"); 76 76 }; 77 like( $@, qr/can not remove non-existant read lock/, "no lock set");77 like($@, qr/can not remove non-existant read lock/, "no lock set"); 78 78 79 79 Test::Nebulous->setup; 80 80 81 81 eval { 82 $neb->create_object( "foo");82 $neb->create_object("foo"); 83 83 84 $neb->unlock_object( "foo", "write");84 $neb->unlock_object("foo", "write"); 85 85 }; 86 like( $@, qr/can not remove non-existant write lock/, "no lock set");86 like($@, qr/can not remove non-existant write lock/, "no lock set"); 87 87 88 88 Test::Nebulous->setup; 89 89 90 90 eval { 91 $neb->create_object( "foo");92 $neb->lock_object( "foo", "write");91 $neb->create_object("foo"); 92 $neb->lock_object("foo", "write"); 93 93 94 $neb->unlock_object( "foo", "read");94 $neb->unlock_object("foo", "read"); 95 95 }; 96 like( $@, qr/can not have a read lock under a write lock/, "read unlock under write lock");96 like($@, qr/can not have a read lock under a write lock/, "read unlock under write lock"); 97 97 98 98 Test::Nebulous->setup; 99 99 100 100 eval { 101 $neb->create_object( "foo");102 $neb->lock_object( "foo", "read");101 $neb->create_object("foo"); 102 $neb->lock_object("foo", "read"); 103 103 104 $neb->unlock_object( "foo", "write");104 $neb->unlock_object("foo", "write"); 105 105 }; 106 like( $@, qr/can not have a write lock under a read lock/, "write unlock under read lock");106 like($@, qr/can not have a write lock under a read lock/, "write unlock under read lock"); 107 107 108 108 Test::Nebulous->setup; … … 111 111 $neb->unlock_object(); 112 112 }; 113 like( $@, qr/2 were expected/, "no params");113 like($@, qr/2 were expected/, "no params"); 114 114 115 115 Test::Nebulous->setup; 116 116 117 117 eval { 118 $neb->unlock_object( "foo");118 $neb->unlock_object("foo"); 119 119 }; 120 like( $@, qr/2 were expected/, "not enough params");120 like($@, qr/2 were expected/, "not enough params"); 121 121 122 122 Test::Nebulous->setup; 123 123 124 124 eval { 125 $neb->unlock_object( "foo", "both");125 $neb->unlock_object("foo", "both"); 126 126 }; 127 like( $@, qr/is read or write/, "not read or write");127 like($@, qr/is read or write/, "not read or write"); 128 128 129 129 Test::Nebulous->setup; 130 130 131 131 eval { 132 $neb->unlock_object( "foo", 'read', 3);132 $neb->unlock_object("foo", 'read', 3); 133 133 }; 134 like( $@, qr/2 were expected/, "too many params");134 like($@, qr/2 were expected/, "too many params"); 135 135 136 136 Test::Nebulous->cleanup;
Note:
See TracChangeset
for help on using the changeset viewer.
