How to test code examples in platform-demos?



https://git.gnome.org/browse/gnome-devel-docs/tree/platform-demos/C
seems to have inline code examples, like

<code mime="application/javascript" style="numbered">
  <![CDATA[
    foo(bar);
  ]]>
</code>
<p>Some explanation of the next line:</p>
<code mime="test/x-python" style="numbered">
  <![CDATA[
    bar(foo);
  ]]>
</code>

Does any approach exist to make sure these code examples do not include
deprecated code, do not include superceded approaches, do not trigger
warnings, do actually compile?

If I wanted to test them, what would I be expected to do?
Parse the content of all <code> nodes, concatenate that in a file, then
try to compile and/or execute it? Or are our numerous code examples
inside one Mallard page not self-contained?

(Background: At FOSDEM there was a talk called "Unicorns" about testing
documentation, and apart from the usual Cucumber/Selenium praise of our
current times that GNOME is far away from, one recommendation was to
automatically compile code examples with warnings and deprecations
enabled and making them a compile failure as a mandatory part of
integration testing. I don't see us doing integration testing soon, but
it would already be a great step to be able to manually compile them.)

andre
-- 
Andre Klapper  |  ak-47 gmx net
http://blogs.gnome.org/aklapper/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]