-
Notifications
You must be signed in to change notification settings - Fork 27
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
TinyPG runnable as command line #9
Conversation
* refactor and isolate business code (aka parse/buil/eval) from presentation (MainForm) * add commandline support on Main() with branch to either GUI or Silent run
strip the StringBuilder from method parameters, it now stand as a Program Property
*bug correction *add unit test *code refactoring
*add some unit test
/// Summary description for ProgramTester | ||
/// </summary> | ||
[TestClass] | ||
public class ProgramTester |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this class for?
The <summary>
is basically empty.
Is it just a unit test for your Program class changes? Or is it more than that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Tom,
Didn't have access to the internet for the week end. I will try to answer
to all your questions.
1/ in MainForm.cs there is a lot of deleted code. I placed the code
in Programs.cs to reduce code duplication : Parse/build/eval of grammar is
done only in Program now and Mainform.cs beiing the view, it should not
contains any business methods.
2/ Sorry for the spaces, I done a code auto-formatting at one time and even
if i tried to go back with the same number of spaces, git report them :(
3/ //var args = Environment.GetCommandLineArgs();
Sure you can remove it, I wasn't sure to reproduce the same behavior of
this command before i changed Main() 's signature, so I commented it for
reference "just in case". I just forget to remove it.
4/ I thought it was for the best... well apparently not. will do as you say
next time :)
5/ Yes ProgramTester is there to help test Program.cs. I should have filled
the
I think I addressed all your mails. Thank you for the reviews and feedbacks.
If any questions, fell free to ask.
Jissai
2013/3/8 Tom Spilman [email protected]
In TinyPG.UnitTests/ProgramTester.cs:
@@ -0,0 +1,79 @@
+using System;
+using System.Text;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using TinyPG.Compiler;
+
+namespace TinyPG.UnitTests
+{
-
///
-
/// Summary description for ProgramTester
-
///
If any questions, fell free to ask.
In TinyPG.UnitTests/ProgramTester.cs:
@@ -0,0 +1,79 @@
+using System;
+using System.Text;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using TinyPG.Compiler;
+
+namespace TinyPG.UnitTests
+{
///
/// Summary description for ProgramTester
///
[TestClass]
public class ProgramTester
What is this class for?
The
is basically empty.
Is it just a unit test for your Program class changes? Or is it more than
that?
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/9/files#r3301515
.
that?
Reply to this email directly or view it on GitHubhttps://github.com//pull/9/files#r3301515
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in next commit
This is fantastic! This mostly covers my needs for issue #3. Just going to review your code some first then we can get this merged. |
I didn't forget about you here... it just has been a busy week. I will get this merged in the next 24 hours. |
Looks like we may have a bug with these changes. If I open one of my existing TPG files with the TinyPG editor and hit Generate the ParseTree.cs, Parser.cs, and Scanner.cs files are no longer generated. Can you give that a test on your end? |
I use the editor and cmd line every day with different tpg file without |
Scanner, Parser, ParserTree were not Generated if the grammar file contains build errors
Well.... yes and no. The grammar has no errors and a correct parse tree is generated:
There are however errors when the parser code is compiled....
These are all expected as my parser references classes and method that exist outside of the TPG file. I guess the key thing is that this all worked fine before... it does not now.... something changed and alter the behavior. |
So testing with your latest change seemed to fix that. Next issue I ran into if I do this:
The command line crashes. If I do this....
It does not. Seems like it assumes the path contains a directory and doesn't account for the case where it doesn't. |
When given e relative filename, TinyPG crashes when launched from command line in cmd window. SetCurrentDirectory should not be called with null or string.Empty directory
use GetFullPath on the argument to convert relative path to absolute pat. It prevents a lot of troubles afterward.
Ok... that seems to have fixed it. As you have noted the console output isn't working from the command line. I'm fine merging this now if you are and get further fixes later. |
Sure we can merge it. |
TinyPG runnable as command line
*add command line support on Main()
*Refactor and isolate business code (Parse/build/eval) from View (MainForm)
*add unit test