Page MenuHomePhabricator

Add an ArgumentParser helper for integers
ClosedPublic

Authored by epriestley on May 3 2022, 9:09 PM.
Tags
None
Referenced Files
F13445749: D21799.diff
Sat, Jul 13, 1:04 AM
F13411840: D21799.id51963.diff
Sat, Jul 6, 10:10 PM
F13381231: D21799.id.diff
Sat, Jun 29, 10:22 PM
F13375150: D21799.diff
Sat, Jun 29, 1:18 AM
F13370457: D21799.id51963.diff
Thu, Jun 27, 6:03 PM
F13353223: D21799.id51958.diff
Sun, Jun 23, 7:13 PM
F13333970: D21799.id51958.diff
Tue, Jun 18, 2:24 PM
F13333675: D21799.diff
Tue, Jun 18, 9:12 AM
Subscribers
None

Details

Summary

Ref T13676. With increased PHP8.1 strictness around null, it seems reasonable to add some convenience parsing to "PhutilArgumentParser".

Add a helper function for parsing integers.

Test Plan

See next change. Tried these arguments:

--count ''
--count asdf
--count 0
--count -3
--count 999999999999999999999999999999999999999999999234
--count 5

Got sensible parsing and appropriate feedback in all cases.

Diff Detail

Repository
rARC Arcanist
Branch
parse1
Lint
Lint Passed
Unit
Test Failures
Build Status
Buildable 25694
Build 35522: arc lint + arc unit

Unit TestsFailed

TimeTest
1,026 msArcanistBundleTestCase::testGitRepository
EXCEPTION (Exception): This patch has binary data. The PHP zlib extension is required to apply patches with binary data to git. Install the PHP zlib extension to continue. #0 /Users/epriestley/dev/core/lib/arcanist/src/parser/ArcanistBundle.php(823): ArcanistBundle::newBase85Data('\x89PNG\r\n\x1A\n\x00\x00\x00\rIHD...', '\n') #1 /Users/epriestley/dev/core/lib/arcanist/src/parser/ArcanistBundle.php(813): ArcanistBundle->emitBinaryDiffBody('\x89PNG\r\n\x1A\n\x00\x00\x00\rIHD...')
0 msArcanistBaseCommitParserTestCase::testBasics
2 assertion(s) passed.
0 msArcanistBaseCommitParserTestCase::testHalt
1 assertion(s) passed.
0 msArcanistBaseCommitParserTestCase::testJump
1 assertion(s) passed.
0 msArcanistBaseCommitParserTestCase::testJumpReturn
1 assertion(s) passed.
View Full Test Results (1 Failed · 99 Passed)

Event Timeline

epriestley created this revision.
This revision was not accepted when it landed; it landed in state Needs Review.May 3 2022, 10:57 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.