Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How Go test tests

How Go test tests

Presentation for golang.tokyo #11

5bfed9aa3a9ebccb0c0f0cb65ee9e012?s=128

Seiji Takahashi

December 11, 2017
Tweet

Transcript

  1. How Go test tests @__timakin__

  2. • Seiji Takahashi • Github: timakin / Twitter: @__timakin__ •

    גࣜձࣾGunosy ৽نࣄۀ։ൃࣨ • Go / Swift ࣗݾ঺հ
  3. Copyright© Gunosy Inc. All Rights Reserved 3 Go / Python

    ΤϯδχΞืूத ▶https://gunosy.co.jp/recruit/ Gunosy͸ɺ౦ژେֶʹ௨͏3ਓͷֶੜͷ
 ʮ৘ใΛੈքதͷਓʹ࠷దʹಧ͚͍ͨʯͱ͍͏૝͍͔Β࢝·Γ·ͨ͠ɻ ౦ূϚβʔζ্৔ɺ࿡ຊ໦ώϧζ΁ͷΦϑΟεҠసΛܦͯɺ
 େ͖͘੒௕͍ͯ͠ΔձࣾͰ׆༂͍ͨ͠ϝϯόʔΛืू͍ͯ͠·͢ɻ
  4. Test of test

  5. None
  6. Go1.9~ ؔ਺͕ͲΜͳग़ྗΛ͢Δͷ͔ɺ ExampleΛఆٛͰ͖ΔΑ͏ʹ

  7. None
  8. None
  9. TestίϚϯυʹؔΘΔ࣮૷ • src/testing • ςετ࣮ߦ࣌ʹ࢖͏T, BͳͲͷ࣮૷ • testing.commonͱ͍͏ߏ଄ମ͕ϝΠϯϩδοΫΛ͍࣋ͬͯΔ • ίϚϯυͷflagύʔε

    • benchmarking, ΧόϨοδଌఆͳͲ • Fail, SkipͳͲͷ࣮૷
  10. common

  11. None
  12. গͳ͍ʂ؆୯ʂ

  13. Mergeͯ͠΄͍͠ʂ

  14. Can you add tests?

  15. ςετͷ࣮ߦ݁Ռͬͯ
 Ͳ͏΍ͬͯ
 ςετ͢ΔΜͩʁ

  16. ςετͬͯͲ͏΍ͬͯ
 ςετ͢ΔΜͩʁ

  17. For testing tests • src/cmd/go/go_test.go • Go commandsͷςετ࣮ߦ

  18. For testing tests • src/cmd/go/go_test.go • Go commandsͷςετ࣮ߦ

  19. For testing tests • testgoData • ͍͍ײ͡ʹfixtureΛಡΈࠐΜͩΓɺ
 ࣮ߦޙͷCleanupΛͯ͘͠ΕΔ


  20. For testing tests • src/cmd/go/testdata/src/* • ςετ༻ͷFixtureΛఆٛ

  21. all.bashΛճͤ͹
 ສࣄOK

  22. Let’s Contribute!

  23. ʕ ◔ϖ◔ʔ < Thank You!!