Changeset 5d8c9a7 for t/variable.t
- Timestamp:
- Jun 14, 2013, 7:39:23 PM (11 years ago)
- Branches:
- master, release-1.10
- Children:
- f20daff
- Parents:
- 2497f99
- git-author:
- David Benjamin <davidben@mit.edu> (06/04/13 19:50:15)
- git-committer:
- David Benjamin <davidben@mit.edu> (06/14/13 19:39:23)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
t/variable.t
r2497f99 r5d8c9a7 68 68 BarnOwl::new_variable_full("fullvar", { 69 69 validsettings => '<short-words>', 70 get_tostring => sub { "value is " .$value },70 get_tostring => sub { $value }, 71 71 set_fromstring => sub { 72 72 die "Too long" unless $_[0] =~ /^...?$/; 73 $value = $_[0];73 $value = lc($_[0]); 74 74 }, 75 75 takes_on_off => 1 76 76 }); 77 is(BarnOwl::getvar("fullvar"), " value isfoo", "fullvar get");78 BarnOwl::set("-q", "fullvar", " bar");79 is(BarnOwl::getvar("fullvar"), " value isbar", "fullvar set");77 is(BarnOwl::getvar("fullvar"), "foo", "fullvar get"); 78 BarnOwl::set("-q", "fullvar", "Bar"); 79 is(BarnOwl::getvar("fullvar"), "bar", "fullvar set"); 80 80 BarnOwl::set("-q", "fullvar"); 81 is(BarnOwl::getvar("fullvar"), " value ison", "fullvar set2");81 is(BarnOwl::getvar("fullvar"), "on", "fullvar set2"); 82 82 BarnOwl::unset("-q", "fullvar"); 83 is(BarnOwl::getvar("fullvar"), " value isoff", "fullvar unset");83 is(BarnOwl::getvar("fullvar"), "off", "fullvar unset"); 84 84 BarnOwl::set("-q", "fullvar", "bogus"); 85 is(BarnOwl::getvar("fullvar"), " value isoff", "fullvar set bogus");86 $value = " something really long";87 is(BarnOwl::getvar("fullvar"), " value is something really long", "fullvar set out-of-band");85 is(BarnOwl::getvar("fullvar"), "off", "fullvar set bogus"); 86 $value = "xyz"; 87 is(BarnOwl::getvar("fullvar"), "xyz", "fullvar set out-of-band"); 88 88 # Kinda verbose, but better to test all forms 89 my $ value = "foo";89 my $newvalue = "foo"; 90 90 BarnOwl::new_variable_full("fullvar", { 91 91 validsettings => '<short-words>', 92 get_tostring => sub { "value is " . $value },92 get_tostring => sub { $newvalue }, 93 93 set_fromstring => sub { 94 94 die "Too long" unless $_[0] =~ /^...?$/; 95 $ value = $_[0];95 $newvalue = lc($_[0]); 96 96 }, 97 97 takes_on_off => 1 98 98 }); 99 isnt(BarnOwl::getvar("fullvar"), "value is foo", "fullvar reinit doesn't override value"); 99 is(BarnOwl::getvar("fullvar"), "xyz", "fullvar reinit doesn't override value"); 100 $newvalue = "abc"; 101 is(BarnOwl::getvar("fullvar"), "abc", "fullvar reinit changed setters"); 100 102 101 103 1;
Note: See TracChangeset
for help on using the changeset viewer.