title: Google Apps Script: How to run all the functions in a .gs file?
body: <p>I'm writing my own test runner for Google Apps Script. I want to put all my tests into one (or more) files. Then I will tell the runner which file(s) have my tests, and it should go through each file and run all the functions in it.</p>
  
  <p>However, in order to do that, I need to:</p>
  
  <ol>
  <li>Identify which file(s) contains the tests.</li>
  <li>Iterate through each identified file and find all the functions.</li>
  <li>Run those functions.</li>
  </ol>
  
  <p>I've tried the following code to identify functions, but its <code>this</code> object seems to refer to my entire GAS code base, so it returns all the functions in my entire code base:</p>
  
  <pre><code>function functions() {
    for(var i in this) {
      if((typeof this[i]).toString()=="function" &amp;&amp; this[i].toString().indexOf("native")==-1){
        Logger.log(this[i].name);
      }
    }
  }
  </code></pre>
  
  <p>Any suggestions?</p>