Skip to content

Instantly share code, notes, and snippets.

@smparkes
Created February 9, 2010 00:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smparkes/298789 to your computer and use it in GitHub Desktop.
Save smparkes/298789 to your computer and use it in GitHub Desktop.
called = undefined;
__defineGetter__("foo",function(){return"bar";});
__defineSetter__("bar",function(bif){called = bif;});
try{
if(foo!=="bar"){
print("should equal bar");
}
} catch(e) {
print("should not have raised "+e);
}
bar = 0xdeadbeef;
if(called!==0xdeadbeef){
print("should have been called with the right value");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment