[TxMt] Automated tests for language grammar rules?
Daryl Spitzer
daryl.spitzer at gmail.com
Wed Apr 18 17:08:07 UTC 2007
I wrote:
> Oops. I got caught submitting a change without testing it. I don't
> seem capable of never repeating that mistake--that's where automated
> tests come in handy.
Is there any facility for creating automated tests for language grammar rules?
It would be useful to be able to define tests within rules or patterns such as:
test_matches = " _italic_ ";
test_no_matches = "snake_case_word";
...or perhaps...
test_matches = { " _italic_ " = 1; "snake_case_word" = 0; "
_italic_number_1_ _italic_number_2 " = 2; };
And then be able to run tests for a specific bundle (say from within
the bundle editor) like one would unit tests, and see if they're green
or if there's a problem.
Would it be possible to write a BundleTester bundle? I guess one
would just need to parse the indicated bundle's language property list
and run any tests found using Oniguruma. Would these test properties
be otherwise ignored?
--
Daryl
On 4/18/07, Daryl Spitzer <daryl.spitzer at gmail.com> wrote:
> > I got around to apply it, thanks.
>
> Thank you.
>
> > > While I was in there, I made the same change to the
> > > 'markup.bold.twiki' match.
> >
> > This won't work, since * is not a word character, so \b will actually
> > have the opposite effect, i.e. making foo*bar*fud match the inner
> > word as bold.
>
> Oops. I got caught submitting a change without testing it. I don't
> seem capable of never repeating that mistake--that's where automated
> tests come in handy. (Which leads me to a question which I will post
> separately.)
>
> > Instead it should probably be (?<!\w) and (?!\w) before/after the
> > match. I didn't make this change though.
>
> I think you made the right call. Unlike snake_case_words, I have yet
> to run across a real-world need for asterisks embedded within words.
> We should wait to "fix" it until it is proven to be a problem.
>
> --
> Daryl
>
>
> On 4/13/07, Allan Odgaard <throw-away-1 at macromates.com> wrote:
> > On 5. Apr 2007, at 22:09, Daryl Spitzer wrote:
> >
> > > It is a bug that words surround by underscores in snake_case_words
> > > in a TextMate Twiki document are italicized. (In this example, the
> > > word "case" is italicized.) When displayed in TWiki, those words
> > > are not italicized.
> > >
> > > I made a small change to the Twiki language (in the Twiki bundle)
> > > to correct this--see the 'markup.italic.twiki' match in the
> > > attached patch.
> >
> > I got around to apply it, thanks.
> >
> > > While I was in there, I made the same change to the
> > > 'markup.bold.twiki' match.
> >
> > This won't work, since * is not a word character, so \b will actually
> > have the opposite effect, i.e. making foo*bar*fud match the inner
> > word as bold.
> >
> > Instead it should probably be (?<!\w) and (?!\w) before/after the
> > match. I didn't make this change though.
> >
> >
> >
> >
> > ______________________________________________________________________
> > For new threads USE THIS: textmate at lists.macromates.com
> > (threading gets destroyed and the universe will collapse if you don't)
> > http://lists.macromates.com/mailman/listinfo/textmate
> >
>
More information about the textmate
mailing list