Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction with a single posting should be an input error #130 #132

Merged
merged 3 commits into from
Jan 31, 2017
Merged

Transaction with a single posting should be an input error #130 #132

merged 3 commits into from
Jan 31, 2017

Conversation

gerdreiss
Copy link
Contributor

@gerdreiss gerdreiss commented Jan 30, 2017

Hi @hrj , I hope these changes are as you had them in mind. Cheers, gerdreiss

Edit by hrj:
closes #130

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 70.301% when pulling 060a7cc on gerdreiss:single-posting-input-error into ad21147 on hrj:master.

@@ -225,6 +225,8 @@ object Processor {

if (postsNoAmount.length > 1) {
throw new InputPosError(s"More than one account posted with unspecified amount: ${postsNoAmount.map(_.accName).mkString(",")}", tx.pos)
} else if (postsWithAmount.isEmpty) {
throw new InputPosError(s"Transaction with single posting: ${tx.posts.head.accName}", tx.pos)
Copy link
Owner

@hrj hrj Jan 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the check you added (postsWithAmount.isEmpty). It is more general than I had imagined.

However, the error message seems to be too narrow. How about: "Transaction with unspecified amount"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do :)

ignoreDirSuiteTestCases(errorRoot, Glob("bugsInputError/**.exec")) { args: Array[String] =>
assertThrows[SettingsError] {
runDirSuiteTestCases(errorRoot, Glob("bugsInputError/**.exec")) { args: Array[String] =>
assertThrows[InputPosError] {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As part of the fix, this testcase should move to a different directory: inputError. I think the bugsInputError directory is for bugs in the error reporting code (which we are fixing now).

Apart from moving to the inputError directory, no other changes should be required.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 70.301% when pulling 3784ad7 on gerdreiss:single-posting-input-error into ad21147 on hrj:master.

@hrj hrj merged commit 76c80db into hrj:master Jan 31, 2017
@hrj hrj added this to the Next release milestone Jan 31, 2017
@gerdreiss gerdreiss deleted the single-posting-input-error branch January 31, 2017 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transaction with a single posting should be an input error
3 participants