Skip to content

Using the GTM tests

mads379 edited this page Sep 14, 2010 · 1 revision

I’ve created a few unit tests for the bundle, here’s a short description of how I work on the syntax definition.

Pre modifying the syntax

  1. Locate the errors and create the simplest scala file that proves the error and safe it in tests/input
  2. Now create a file containing the expected output and place it in tests/output. I Use GTM to create the sudo xml format that TextMate uses to describe the syntax of the current file and modify it so the scope matches my expectations. Get the sudo-XML for the current scope like this:
    $ cd ~/Library/Application\ Support/TextMate/Pristine\ Copy/Bundles/Scala.tmbundle/Support/tests
    $ ./gtm < input/nameOfFile.scala ../../Syntaxes/Scala.tmLanguage
  3. Add the test to run_tests.rb with a simple description of what it is testing.
  4. Verify that the test is failing

Modifying the syntax

  1. Modify the syntax and use ctrl+shift+p to inspect the inferred scope. Keep doing this until you’re satisfied with the scope.
  2. Show the bundle editor, locate the Scala bundle and drag it onto your Desktop. Inspect the contents and open the run_tests.rb file and run it using cmd+r
  3. Verify that your test is now passing.

NB: You have to copy the bundle that way to the Desktop because your changes to the syntax is only stored in a tmDelta file and will not be registered by GTM so you have to copy it to merge your changes.

Clone this wiki locally