src/pretty: add usage example in DocUnit
authorAlexandre Terrasa <alexandre@moz-code.org>
Wed, 10 Dec 2014 23:39:04 +0000 (18:39 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Wed, 10 Dec 2014 23:39:04 +0000 (18:39 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/pretty.nit

index a99f3a6..75d9879 100644 (file)
 
 # Library used to pretty print Nit code.
 #
+# Usage:
+#
+#     import parser_util
+#     var tc = new ToolContext
+#     var nmodule = tc.parse_something("class A\nfun   toto :  Int  do   return   5\nend")
+#     var ppv = new PrettyPrinterVisitor
+#     var pmodule = ppv.pretty(nmodule)
+#     assert pmodule.write_to_string == """
+#     class A
+#     \tfun toto: Int do return 5
+#     end"""
+#
 # See `nitpretty` tool for more documentation.
 module pretty