Guest User

Untitled

a guest
Feb 19th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <?php
  2.  
  3. require 'lib/Lambda.php';
  4. require 'lib/shortcuts.php';
  5.  
  6. function describe($context, $examples) {
  7. $instance = new stdClass;
  8.  
  9. if (isset($examples['before']) && $before = $examples['before'])
  10. unset($examples['before']);
  11.  
  12. if (isset($examples['after']) && $after = $examples['after'])
  13. unset($examples['after']);
  14.  
  15. $before->call($instance);
  16.  
  17. foreach ($examples as $description => $example) {
  18. $example->call($instance);
  19. }
  20.  
  21. $after->call($instance);
  22. print_r($instance);
  23. }
  24.  
  25. class EmulateStatement { function expect() {} }
  26. function with() {
  27. return new EmulateStatement;
  28. }
  29.  
  30.  
  31. describe('string', array(
  32. 'before' => def(& $self)?
  33. $self = 'your mum'
  34. :fed(),
  35.  
  36. 'should have a length' => def(& $self)?
  37. print_r($self)
  38. :fed(),
  39. ));
  40. ?>
Add Comment
Please, Sign In to add comment