Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Allow AddProvider to still work with some custom types #102

Merged
merged 3 commits into from
Jun 4, 2020

Conversation

andrew-werdna
Copy link
Sponsor Contributor

Before, even if using AddProvider() some custom types would not work, as there was no check for mapperTag[tag] function before calling userDefinedArray().
^ it would fail with Tag unsupported: .... even if provided with a tag!

Since AddProvider() can provide the ability to instantiate/manipulate the type, it would be great if when using AddProvider() the user could provide a tag that would work even for some custom types.

If you comment out the changes I made to faker.go and run the tests go test ./... you will see the failure, even though AddProvider() was called to add the desired tag.

Fixes issue #101

update module path

add more log statements

add more clear logs

add more log statements in critical places

remove panic causing line

remove panic causing line 2

add check for custom tag handler, and logging

add check for user defined provider before calling built in func

put back module & imports the way they were

add test and logic for checking for custom tag before defaulting to userDefinedArray func

update readme and add example

update example to not be random and therefore pass the test command

add comment
@codecov
Copy link

codecov bot commented Jun 3, 2020

Codecov Report

Merging #102 into master will decrease coverage by 0.14%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #102      +/-   ##
==========================================
- Coverage   95.04%   94.90%   -0.15%     
==========================================
  Files          10       10              
  Lines         989     1001      +12     
==========================================
+ Hits          940      950      +10     
- Misses         27       28       +1     
- Partials       22       23       +1     
Impacted Files Coverage Δ
faker.go 90.67% <83.33%> (-0.20%) ⬇️

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 0e4c0b6...6dc7ac8. Read the comment docs.

Copy link
Owner

@bxcodec bxcodec left a comment

Choose a reason for hiding this comment

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

LGTM.

Thanks for the PR

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants