第七章 go 测试

go语言的单元测试,需要在被测文件的同目录下新建一个文件,名称为xxxx_test,写单元测试代码时,需要引入testing包

在test.go中的代码:

package main

import (
	"fmt"
)

func Haha(s string){
	fmt.Println(s)
}

在test.go同级目录创建test_test.go文件,代码如下:

package main
import "testing"

func TestHaha(t *testing.T) {
	Haha("haha")
}

文件目录结构如下:

 在test_test.go中执行,结果如下:

=== RUN   TestHaha
haha
--- PASS: TestHaha (0.00s)
PASS

Process finished with the exit code 0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
蕴瑜课堂大学英语(四) unit 2 customs 第二章测试答案如下: 第一部分:听力(共20分) 1. B 2. C 3. A 4. B 5. C 6. C 7. A 8. C 9. B 10. A 第二部分:语言知识运用(共30分) 11. B 12. A 13. C 14. B 15. C 16. A 17. C 18. B 19. A 20. B 21. C 22. A 23. B 24. C 25. A 第三部分:阅读理解(共40分) 26. D 27. A 28. C 29. B 30. C 31. D 32. B 33. A 34. D 35. A 36. C 37. B 38. D 39. C 40. A 第四部分:写作(共10分) One possible version: Customs are a fascinating aspect of different countries and cultures. They reflect the values, traditions, and behaviors that are important to a particular group of people. In my country, China, customs play a significant role in our daily lives. For example, the Spring Festival is our most important traditional holiday. During this time, families gather together to celebrate and show respect to our ancestors. We also give red envelopes with money to children and cook special dishes for the occasion. Another important custom is the Dragon Boat Festival, where we eat sticky rice dumplings and watch dragon boat races. In contrast, the customs in Western countries may vary greatly. For instance, Christmas is a major holiday in many Western countries. It is celebrated on December 25th and involves decorating trees, giving gifts, and sharing meals with loved ones. Halloween is also a widely celebrated custom in Western countries, where people dress up in costumes, go trick-or-treating, and carve pumpkins. Understanding and respecting customs is essential when visiting or interacting with people from different cultures. It allows us to appreciate the diversity and uniqueness of different customs and enhances cultural understanding and cooperation.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值