title: Understanding QUnit exception testing
body: <p>While writing QUnit tests I was suprised by the behaviour of 'throws'.
  Regarding the following code (<a href="http://jsfiddle.net/DuYAc/75/">http://jsfiddle.net/DuYAc/75/</a>), could anyone please answer my questions:</p>
  
  <pre><code>    function subfunc() {
          throw "subfunc error";
      }
  
      function func() {
          try {
              subfunc();
          } catch (e) {}
      }
  
      test("official cookbook example", function () {
          throws(function () {
              throw "error";
          }, "Must throw error to pass.");
      });
  
      test("Would expect this to work", function () {
          throws(subfunc(), "Must throw error to pass.");
      });
  
      test("Why do I need this encapsulation?", function () {
          throws(function(){subfunc()}, "Must throw error to pass.");
      });
  
      test("Would expect this to fail, because func does not throw any exception.", function () {
          throws(func(), "Must throw error to pass.");
      });
  </code></pre>
  
  <p>Only the second test fails, although this would have been my natural choice of writing this test...</p>
  
  <p>Questions:</p>
  
  <p>1) Why do I have to use an inline function to surround my tested function?</p>
  
  <p>2) Why does the last test not fail? 'func' does not throw any exception.</p>
  
  <p>Would be grateful to read any explanation.</p>