- Distributed Computing with Go
- V.N. Nikhil Anurag
- 152字
- 2021-06-24 18:36:08
Testing in Go
Testing is an important part of programming, whether it is in Go or in any other language. Go has a straightforward approach to writing tests, and in this section, we will look at some important tools to help with testing.
There are certain rules and conventions we need to follow to test our code. They can be listed as follows:
- Source files and associated test files are placed in the same package/folder
- The name of the test file for any given source file is <source-file-name>_test.go
- Test functions need to have the "Test" prefix, and the next character in the function name should be capitalized
In the remainder of this section, we will look at three files and their associated tests:
- variadic.go and variadic_test.go
- addInt.go and addInt_test.go
- nil_test.go (there isn't any source file for these tests)
Along the way, we will introduce any further concepts we might use.
推薦閱讀
- PLC控制程序精編108例
- Linux系統(tǒng)文件安全實(shí)戰(zhàn)全攻略
- 蘋(píng)果OS X Mavericks 10.9應(yīng)用大全
- 完美應(yīng)用RHEL 8
- AutoCAD 2014中文版從入門到精通
- OpenStack系統(tǒng)架構(gòu)設(shè)計(jì)實(shí)戰(zhàn)
- OpenSolaris設(shè)備驅(qū)動(dòng)原理與開(kāi)發(fā)
- Hands-On UX Design for Developers
- Drupal 7 Cookbook
- bash shell腳本編程經(jīng)典實(shí)例(第2版)
- 操作系統(tǒng)之哲學(xué)原理第2版
- 電腦辦公(Windows10+Office2016)從新手到高手
- 鴻蒙HarmonyOS應(yīng)用開(kāi)發(fā)從入門到精通
- 嵌入式Linux設(shè)備驅(qū)動(dòng)程序開(kāi)發(fā)指南(原書(shū)第2版)
- 深入理解嵌入式Linux設(shè)備驅(qū)動(dòng)程序