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

fix(config):resolve expected type in defaultResolver #1565 #2134

Closed
wants to merge 7 commits into from

Conversation

zjx-ERROR
Copy link
Contributor

Description (what this PR does / why we need it):

Which issue(s) this PR fixes (resolves / be part of):

Other special notes for the reviewers:

Comment on lines +170 to +171
case 'M':
// We've already checked the map above.
Copy link
Member

Choose a reason for hiding this comment

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

I feel a little confused about this, could you please describe why we need a case 'M'? and I can see the 'FNTfnt' matches the 'True|False|Null', so what does the 'OYoy' character match?

config/options.go Outdated Show resolved Hide resolved
@kagaya85
Copy link
Member

kagaya85 commented Jun 27, 2022

Thanks for your contribution, one suggestion, it's a good idea to add some description about this PR for reviewers to review :)

fix #1565

@shenqidebaozi shenqidebaozi linked an issue Jun 27, 2022 that may be closed by this pull request
@kagaya85 kagaya85 requested a review from ymh199478 June 27, 2022 11:51
@kagaya85 kagaya85 added the enhancement New feature or request label Jun 27, 2022
@zjx-ERROR
Copy link
Contributor Author

zjx-ERROR commented Jun 28, 2022

Hey, @kagaya85 ,thanks for your suggestion.
The resolveTable could generated by following:

var resolveTable = make([]byte,256)
// Sign
resolveTable[int('+')] = 'S'
resolveTable[int('-')] = 'S'
// Digit
for _, c := range "0123456789" {
    resolveTable[int(c)] = 'D' 
}
// In map
for _, c := range "yYnNtTfFoO~" {
    resolveTable[int(c)] = 'M'
}
// Float
resolveTable[int('.')] = '.'

The resolveMap is a predefined map of potential types.

"<<" is merge key,see: merge key. I'm sorry this part hasn't been completed yet, which makes you confused.And I remove "<<" temporarily.

@codecov-commenter
Copy link

codecov-commenter commented Jun 28, 2022

Codecov Report

Merging #2134 (a2882cd) into main (25c5996) will decrease coverage by 0.70%.
The diff coverage is 40.29%.

❗ Current head a2882cd differs from pull request most recent head 30f49dc. Consider uploading reports for the commit 30f49dc to get more accurate results

@@            Coverage Diff             @@
##             main    #2134      +/-   ##
==========================================
- Coverage   79.08%   78.37%   -0.71%     
==========================================
  Files          84       84              
  Lines        3696     3760      +64     
==========================================
+ Hits         2923     2947      +24     
- Misses        560      594      +34     
- Partials      213      219       +6     
Impacted Files Coverage Δ
config/options.go 62.40% <40.29%> (-26.13%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 25c5996...30f49dc. Read the comment docs.

@kagaya85
Copy link
Member

Hey, @kagaya85 ,thanks for your suggestion. The resolveTable could generated by following:

var resolveTable = make([]byte,256)
// Sign
resolveTable[int('+')] = 'S'
resolveTable[int('-')] = 'S'
// Digit
for _, c := range "0123456789" {
    resolveTable[int(c)] = 'D' 
}
// In map
for _, c := range "yYnNtTfFoO~" {
    resolveTable[int(c)] = 'M'
}
// Float
resolveTable[int('.')] = '.'

The resolveMap is a predefined map of potential types.

Thanks for your explanation, and my question is, the resolveTable will map "yYoO" to case M, but I don't see any keys in resolveMap begin with "yYoO", so maybe it is not necessary? Please let me know if I have missed anything.

One more thing, it looks like some additional test cases are needed to better explain and maintain the coverage.

@daemon365 daemon365 closed this Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Non-string type config with default value can't work
4 participants