network_detection_test.go 660 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * @Author: LinkLeong a624669980@163.com
  3. * @Date: 2022-05-08 15:07:31
  4. * @LastEditors: LinkLeong a624669980@163.com
  5. * @LastEditTime: 2022-05-09 11:43:30
  6. * @FilePath: /CasaOS/pkg/utils/network_detection_test.go
  7. * @Description:
  8. *
  9. * Copyright (c) 2022 by LinkLeong a624669980@163.com, All Rights Reserved.
  10. */
  11. package utils
  12. import (
  13. "fmt"
  14. "testing"
  15. )
  16. func TestGetResultTest(t *testing.T) {
  17. list := []string{"https://www.google.com", "https://www.bing.com", "https://www.baidu.com"}
  18. data := make(chan string)
  19. //data <- "init"
  20. for _, v := range list {
  21. go GetNetWorkTypeDetection(data, v)
  22. }
  23. result := <-data
  24. close(data)
  25. fmt.Println(result)
  26. }