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

fix: special slice types cause panic when reflectively generating values #91

Merged
merged 1 commit into from
Apr 18, 2020

Conversation

rgaskill
Copy link
Contributor

@rgaskill rgaskill commented Mar 4, 2020

The updated faker test will product the following without the convert update for slices.

panic: reflect.Set: value of type int32 is not assignable to type faker.SomeInt32 [recovered]
        panic: reflect.Set: value of type int32 is not assignable to type faker.SomeInt32

goroutine 34 [running]:
testing.tRunner.func1.1(0x1162b20, 0xc00017f960)
        /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:941 +0x3d0
testing.tRunner.func1(0xc000166240)
        /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:944 +0x3f9
panic(0x1162b20, 0xc00017f960)
        /usr/local/Cellar/go/1.14/libexec/src/runtime/panic.go:967 +0x15d
reflect.Value.assignTo(0x11622e0, 0xc00018402c, 0x85, 0x11a5a9a, 0xb, 0x1162220, 0x0, 0x33, 0xc000186000, 0x17)
        /usr/local/Cellar/go/1.14/libexec/src/reflect/value.go:2403 +0x426
reflect.Value.Set(0x1162220, 0xc000186000, 0x185, 0x11622e0, 0xc00018402c, 0x85)
        /usr/local/Cellar/go/1.14/libexec/src/reflect/value.go:1532 +0xbd
github.com/bxcodec/faker/v3.getValue(0x115f740, 0xc00000f820, 0x197, 0x1, 0x115f740, 0xc00000f820, 0x197)
        /Users/roarkegaskill/Developer/faker/faker.go:451 +0xd67
github.com/bxcodec/faker/v3.getValue(0x119c840, 0xc000128780, 0x199, 0x119c801, 0x119c840, 0xc000128780, 0x320)
        /Users/roarkegaskill/Developer/faker/faker.go:396 +0x22e1
github.com/bxcodec/faker/v3.getValue(0x116c9a0, 0xc000128280, 0x0, 0xc00005c980, 0x100c686, 0xc000128280, 0x280)
        /Users/roarkegaskill/Developer/faker/faker.go:355 +0x169e
github.com/bxcodec/faker/v3.FakeData(0x116c9a0, 0xc000128280, 0x11, 0xc00005ca70)
        /Users/roarkegaskill/Developer/faker/faker.go:280 +0x1c6
github.com/bxcodec/faker/v3.TestFakerData(0xc000166240)
        /Users/roarkegaskill/Developer/faker/faker_test.go:277 +0x5c
testing.tRunner(0xc000166240, 0x11b2650)
        /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:992 +0xdc
created by testing.(*T).Run
        /usr/local/Cellar/go/1.14/libexec/src/testing/testing.go:1043 +0x357
FAIL    github.com/bxcodec/faker/v3     0.148s
?       github.com/bxcodec/faker/v3/support/slice       [no test files]
FAIL

@codecov
Copy link

codecov bot commented Mar 4, 2020

Codecov Report

Merging #91 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #91      +/-   ##
==========================================
+ Coverage   94.92%   94.92%   +<.01%     
==========================================
  Files          10       10              
  Lines         965      966       +1     
==========================================
+ Hits          916      917       +1     
  Misses         27       27              
  Partials       22       22
Impacted Files Coverage Δ
faker.go 90.37% <100%> (+0.02%) ⬆️

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 7198e34...209536a. 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 sir @rgaskill

@bxcodec bxcodec merged commit 1c6d6ed into bxcodec:master Apr 18, 2020
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