Conversation
C is a shell script that compiles and executes C source code in the shell.
end | ||
|
||
test do | ||
system "c", "--help" |
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.
Can this test be modified to do something more substantial than e.g. --version
or --help
? See cmake.rb
for an example of an application formula with a good test and tinyxml2.rb
for an example of a library formula with a good test. Thanks!
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.
@MikeMcQuaid Hey, currently we have unit testing. Can we just call that?
test do
Dir.chdir("tests") do
system "test.sh"
end
end
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.
It's be good if you can actually just use an invocation of the program to e.g. run a small script. See cmake.rb
for something similar.
Note to other @Homebrew/owners: this is a 10 day old but pretty popular project. |
I'd very much love to see this accepted/merged. |
Okay, v0.08 removes the |
@janten As soon as @ryanmjacobs tags Great work! |
@LinusU Okay, I've pushed v0.09. 😀 |
Nice! @janten Here are the new values: url "https://github.com/ryanmjacobs/c/archive/v0.09.tar.gz"
sha1 "41d284be0f9d59d45b9cc14e98dbe01ef060c1c1" |
I just downloaded v0.09 myself and get the SHA1 sum as |
Hmm, that's strange. Well, as long as it works. Here is how I got it:
|
Looks like SHA1 is now deprecated in favor of SHA256, so I updated the formula again. |
end | ||
|
||
test do | ||
system "echo", "int main(void){return 0;}", "|c" |
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.
(testpath/"test.c").write "int main(void){return 0;}"
system bin/"c", "test.c"
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.
@janten Remind you a bit, current test case is incorrect.
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.
No, it isn't. c
takes input from stdin just fine and the test is meant to be run after the installation, when c
will already be in $PATH
, not in bin/
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.
First of all, system "echo", "int main(void){return 0;}", "|c"
equals echo "int main(void){return 0;}" "|c"
in shell. The pipe is fake.
Second, all test have to use full path. Users' environment setting is irrelevant.
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.
I'll happily admit that I do not know anything about ruby (and seeing this, I don't really want to deal with it) – my guess was that I would need to write system "echo", … "\"|c\""
to get a string instead of a pipe. I have updated the test accordingly. Even though, I fail to see any reason to use a source code file instead of a simple echo
and from other formula's tests I gather that the path should be read from a variable as #{bin}
instead of being literal bin/
.
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.
If you want to read from pipe. Make test like this:
pipe_output(bin/"c", "int main(void){return 0;}")
As for your question on #{bin}
and bin/
, they are both OK. "#{bin}/c"
equals (bin/"c").to_s
.
The last thing I'm a bit hesistant about with this formula: this is not the thing people think of when they think of |
I can not really think of any other name for it and I guess there is not much of a problem since one cannot install C, the language, anyway. IMHO the In the end the author should decide the name of his program and as long as this tool is called "c", the formula should have the same name. |
I have the same concern; it's difficult to imagine an unambiguous and discoverable name for a project called |
I agree with @janten. It seems intuitive that |
Except someone who doesn't have a huge amount of familiarity with C and doesn't know that it isn't like e.g. |
Please do what @xu-cheng has asked; either write to a file or use |
Any ideas why the tests are failing? |
Looks like flakiness on our end; we're having some trouble with our CI hardware. |
I am passing on this due to the naming issue. In my opinion, "c" is far too ambiguous. Other maintainers, feel free to overrule me, but this has been sitting here untouched for two months. |
I agree. |
C is a shell script that compiles and executes C source code in the shell.