From 4a9d2940b3844f6a84b3352c374c919f5400ceb4 Mon Sep 17 00:00:00 2001 From: theodus Date: Fri, 28 Jul 2017 11:53:04 -0400 Subject: [PATCH] formatting --- changelog.pony | 14 +++++----- changelog_tool.pony | 22 ++++++++------- main.pony | 8 +++--- tests/main.pony | 65 ++++++++++++++++++++++----------------------- 4 files changed, 55 insertions(+), 54 deletions(-) diff --git a/changelog.pony b/changelog.pony index d74e972..77df061 100644 --- a/changelog.pony +++ b/changelog.pony @@ -45,8 +45,8 @@ class Changelog fun string(): String iso^ => let str = (recover String end) - .>append(_Util.changelog_heading()) - .>append("\n") + .> append(_Util.changelog_heading()) + .> append("\n") if unreleased isnt None then str.append(unreleased.string()) end for release in released.values() do str.append(release.string()) @@ -73,7 +73,7 @@ class Release changed = Section._emtpy(Changed) fun string(): String iso^ => - let str = recover String.>append(heading).>append("\n\n") end + let str = recover String .> append(heading) .> append("\n\n") end for section in [fixed; added; changed].values() do match section | let s: this->Section => @@ -104,8 +104,8 @@ class Section fun string(): String => recover String - .>append("### ") - .>append(label.text()) - .>append("\n\n") - .>append(entries) + .> append("### ") + .> append(label.text()) + .> append("\n\n") + .> append(entries) end diff --git a/changelog_tool.pony b/changelog_tool.pony index 494e15c..c601f13 100644 --- a/changelog_tool.pony +++ b/changelog_tool.pony @@ -1,6 +1,6 @@ use "files" -use "time" use "peg" +use "time" class ChangelogTool let _env: Env @@ -13,7 +13,7 @@ class ChangelogTool fun verify() => _env.out.print("verifying " + _filename + "...") try - let ast = _parse()? + _parse()? _env.out.print(_filename + " is a valid changelog") end @@ -21,9 +21,10 @@ class ChangelogTool try _check_version(version)? let date = Date(Time.seconds()).format("%Y-%m-%d") - let changelog: String = Changelog(_parse()?)? - .create_release(version, date)? - .string() + let changelog: String = + Changelog(_parse()?)? + .create_release(version, date)? + .string() _edit_or_print(edit, changelog) else _env.err.print("unable to perform release prep") @@ -40,9 +41,10 @@ class ChangelogTool fun unreleased(edit: Bool) => try - let changelog: String = Changelog(_parse()?)? - .create_unreleased() - .string() + let changelog: String = + Changelog(_parse()?)? + .create_unreleased() + .string() _edit_or_print(edit, changelog) else _env.out.print("error") @@ -52,8 +54,8 @@ class ChangelogTool if edit then with file = File(_filepath) do file - .>write(s) - .>flush() + .> write(s) + .> flush() end else _env.out.print(s) diff --git a/main.pony b/main.pony index bd22702..e922646 100644 --- a/main.pony +++ b/main.pony @@ -3,10 +3,10 @@ use "options" actor Main new create(env: Env) => - // TODO use the new cli package - // https://github.com/ponylang/ponyc/issues/1737 - let options = Options(env.args) - .>add("edit", "e", None) + // TODO use the cli package instead of options + let options = + Options(env.args) + .> add("edit", "e", None) try var edit = false diff --git a/tests/main.pony b/tests/main.pony index 9048182..4a43913 100644 --- a/tests/main.pony +++ b/tests/main.pony @@ -40,48 +40,48 @@ class iso _TestParseVersion is UnitTest fun name(): String => "parse version" fun apply(h: TestHelper) => - ParseTest(h, ChangelogParser.version()).run([ - ("0.0.0", "(Version 0.0.0)\n") - ("1.23.9", "(Version 1.23.9)\n") - ("0..0", "") - (".0.0", "") - ("0..", "") - ("0", "") - ]) + ParseTest(h, ChangelogParser.version()).run( + [ ("0.0.0", "(Version 0.0.0)\n") + ("1.23.9", "(Version 1.23.9)\n") + ("0..0", "") + (".0.0", "") + ("0..", "") + ("0", "") + ]) class iso _TestParseDate is UnitTest fun name(): String => "parse date" fun apply(h: TestHelper) => - ParseTest(h, ChangelogParser.date()).run([ - ("2017-04-07", "(Date 2017-04-07)\n") - ("0000-00-00", "(Date 0000-00-00)\n") - ("0000-00-0", "") - ("0000-0-00", "") - ("000-00-00", "") - ("00-0000-00", "") - ]) + ParseTest(h, ChangelogParser.date()).run( + [ ("2017-04-07", "(Date 2017-04-07)\n") + ("0000-00-00", "(Date 0000-00-00)\n") + ("0000-00-0", "") + ("0000-0-00", "") + ("000-00-00", "") + ("00-0000-00", "") + ]) class iso _TestParseEntries is UnitTest fun name(): String => "parse entries" fun apply(h: TestHelper) => - ParseTest(h, ChangelogParser.entries()).run([ - ("32-bit ARM port.", "") - ("- 32-bit ARM port.", "(Entries - 32-bit ARM port.)\n") - ("- abc\n - def\n\n", "(Entries - abc\n - def)\n") - ( """ - - abc - - def - - ghi - - jkl - """, - "(Entries - abc\n - def\n - ghi\n - jkl)\n") - ("- @fowles: handle regex empty match.", - "(Entries - @fowles: handle regex empty match.)\n") - ("- Upgrade to LLVM 3.9.1 ([PR #1498](https://github.com/ponylang/ponyc/pull/1498))", - "(Entries - Upgrade to LLVM 3.9.1 ([PR #1498](https://github.com/ponylang/ponyc/pull/1498)))\n") - ]) + ParseTest(h, ChangelogParser.entries()).run( + [ ("32-bit ARM port.", "") + ("- 32-bit ARM port.", "(Entries - 32-bit ARM port.)\n") + ("- abc\n - def\n\n", "(Entries - abc\n - def)\n") + ( """ + - abc + - def + - ghi + - jkl + """, + "(Entries - abc\n - def\n - ghi\n - jkl)\n" ) + ( "- @fowles: handle regex empty match.", + "(Entries - @fowles: handle regex empty match.)\n" ) + ( "- Upgrade to LLVM 3.9.1 ([PR #1498](https://github.com/ponylang/ponyc/pull/1498))", + "(Entries - Upgrade to LLVM 3.9.1 ([PR #1498](https://github.com/ponylang/ponyc/pull/1498)))\n" ) + ]) class iso _TestParseChangelog is UnitTest fun name(): String => "parse CHANGELOG" @@ -122,7 +122,6 @@ primitive _Logv match bs | let s: String => s | let a: Array[U8] val => String.from_array(a) - else "" end) end h.log(consume str)