test_test.go 967 B

123456789101112131415161718192021222324252627282930313233343536
  1. package main
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. func TestA(T *testing.T) {
  7. values := []int{1, 2, 3, 4, 5, 6, 7, 8, 9}
  8. ch := make(chan int)
  9. for _, v := range values {
  10. go func(v int) {
  11. ch <- v
  12. }(v)
  13. }
  14. for i := 0; i < len(values); i++ {
  15. fmt.Println(<-ch)
  16. }
  17. }
  18. func TestB(T *testing.T) {
  19. CollArr := []string{"company_base", "company_employee", "company_history_name", "company_partner", "annual_report_base", "annual_report_website",
  20. "special_enterprise", "special_foundation", "special_gov_unit", "special_hongkong_company", "special_law_office", "special_social_organ", "special_trade_union"}
  21. for _, v := range CollArr {
  22. switch v {
  23. case "company_base":
  24. fmt.Println("company_base")
  25. case "company_employee":
  26. fmt.Println("company_employee")
  27. case "special_enterprise", "special_foundation", "special_gov_unit", "special_hongkong_company", "special_law_office", "special_social_organ", "special_trade_union":
  28. fmt.Println("special")
  29. }
  30. }
  31. }