Skip to content

new functions to phpt #880

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

Closed
wants to merge 19 commits into from
Closed

new functions to phpt #880

wants to merge 19 commits into from

Conversation

marcosptf
Copy link
Contributor

Hello everyone!

this is my first contribution, im very happy for write phpt and help my comunity here in Brasil PHPSP.
i would like a lot that my pull request is merged!

thanks to all

:-)

@Kubo2
Copy link
Contributor

Kubo2 commented Oct 30, 2014

@php-pulls This one can be directly merged in my opinion, can't it?

@marcosptf
Copy link
Contributor Author

👍 to me, that's okey

merge!
merge!
merge!
merge!

kkk

@gerocha
Copy link

gerocha commented Oct 30, 2014

👍

2 similar comments
@liriokuhnen
Copy link

👍

@dritec
Copy link

dritec commented Oct 30, 2014

👍

@edgarsandi
Copy link
Contributor

👎 the Travis build failed, the 013.phpt file have the same test of the 012.phpt but with different EXPECT.
The 012.phpt is the correct test, because the WARNING is really expected.
Fix it before merge on oficial repository

Both files have the same test code

echo addcslashes("zoo['.']","z..A");

And expects differente outputs

In the 012.phpt:
--EXPECT--
Warning: addcslashes(): Invalid '..'-range, '..'-range needs to be incrementing in %s on line %d
\zoo['\.']

And in the 013.phpt:
--EXPECT--
\zoo['\.']

The 012.phpt output:

phpt 012.phpt
PASS    /home/edgarsandi/proj/studies/php_src_tests/func/012.phpt
MEM:    1081.83 kB

The 013.phpt output:

$ phpt 013.phpt 
FAIL    /home/edgarsandi/proj/studies/php_src_tests/func/013.phpt
MEM:    1100.2 kB

$ cat 013.out 
Warning: addcslashes(): Invalid '..'-range, '..'-range needs to be incrementing in /home/edgarsandi/proj/studies/php_src_tests/func/013.php on line 2
\zoo['\.']%

@edgarsandi
Copy link
Contributor

@marcosptf
The 013.phpt file is not necessary, remove it

@marcosptf
Copy link
Contributor Author

👍

@nikic
Copy link
Member

nikic commented Oct 30, 2014

Hey @marcosptf!

PHP places tests for functions into the ext/*/tests directory of the extension they belong to. For example, addcslashes is part of the standard extension, which is why it is tested in ext/standard/tests/string. For example the test https://github.com/php/php-src/blob/master/ext/standard/tests/strings/addcslashes_003.phpt already includes the test case you added in 013.phpt.

So I think you should take a look at the existing tests for these functions and see if they're missing test cases and add those (either by editing the tests or adding new files in the right place). Another useful tool is http://gcov.php.net/PHP_5_6/lcov_html/, which contains code coverage information. This can be used to find conditions that have no been tested yet. For example, here is the addcslashes implementation: http://gcov.php.net/PHP_5_6/lcov_html/ext/standard/string.c.gcov.php#3479 You can see that escaping of \a and \b has not been tested properly yet.

(The global tests/ directory is for language tests, in particular tests/func/ is for tests for userland function definitions and calls.)

@marcosptf
Copy link
Contributor Author

hi @nikic,

i would like to thanks for help, like i said on my first comment, this is my first contribution, and i'm happy about it!
:-)

And i will use your instructions to next contributions.
I fixed the things that you have suggested.
Thanks so much!

@Kubo2 @php-pulls

@edgarsandi
Copy link
Contributor

Hi @marcosptf
Other important link to see before create new tests to functions is the tested_functions

@marcosptf marcosptf mentioned this pull request Oct 31, 2014
@rogeriopradoj
Copy link

👍

@marcosptf
Copy link
Contributor Author

hi @nikic,

I has fixed the things that you have suggested.
I think now can merge!

Thanks

:-)

@Kubo2 @php-pulls

@smalyshev
Copy link
Contributor

It looks like cases covered in these tests are already covered by tests/strings/add-and-stripcslashes.phpt and tests/strings/bin2hex_basic.phpt

@smalyshev
Copy link
Contributor

looks like this one was already merged

@smalyshev smalyshev closed this Jan 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants