title: How do I test a code generation tool?
body: <p>I am currently developing a small project of mine that generates SQL calls in a dynamic way to be used by an other software. The SQL calls are not known beforehand and therefore I would like to be able to unit test the object that generates the SQL. </p>
  
  <p>Do you have a clue of how would be the best approach to do this? Bear in mind that there is no possible way to know all the possible SQL calls to be generated.</p>
  
  <p>Currently the only idea I have is to create test cases of the accepted SQL from the db using regex and make sure that the SQL will compile, but this does not ensure that the call returns the expected result.</p>
  
  <p>Edited: Adding more info:</p>
  
  <p>My project is an extension of Boo that will allow the developer to tag his properties with a set of attributes. This attributes are used to identify how the developers wants to store the object in the DB. For example:</p>
  
  <pre><code># This attribute tells the Boo compiler extension that you want to
  # store the object in a MySQL db. The boo compiler extension will make sure that you meet
  # the requirements
  [Storable(MySQL)] 
  class MyObject():
      # Tells  the compiler that name is the PK
      [PrimaryKey(Size = 25)]
      [Property(Name)]
      private name as String
  
      [TableColumn(Size = 25)]
      [Property(Surname)]
      private surname as String
  
      [TableColumn()]
      [Property(Age)]
      private age as int
  </code></pre>
  
  <p>The great idea is that the generated code wont need to use reflection, but that it will added to the class in compile time. Yes the compilation will take longer, but there won't be a need to use Reflection at all. I currently have the code working generating the required methods that returns the SQL at compile time, they are added to the object and can be called but I need to test that the generated SQL is correct :P</p>