@@ -4,16 +4,13 @@ package login
4
4
5
5
import (
6
6
"encoding/json"
7
- "errors"
8
7
"fmt"
9
8
"net/http"
10
9
"net/http/httptest"
11
- "syscall"
12
10
"testing"
13
11
"time"
14
12
15
13
"github.com/spf13/viper"
16
- "github.com/stretchr/testify/assert"
17
14
"github.com/twitchdev/twitch-cli/internal/util"
18
15
)
19
16
@@ -160,40 +157,3 @@ func TestUserAuthServer(t *testing.T) {
160
157
a .Equal (state , ur .State , "State mismatch" )
161
158
a .Equal (code , ur .Code , "Code mismatch" )
162
159
}
163
-
164
- func TestIsWsl (t * testing.T ) {
165
- a := assert .New (t )
166
-
167
- var (
168
- // syscall.Utsname.Release value on various systems
169
-
170
- // Ubuntu 20.04 on WSL2 on Windows 10 x64 20H2
171
- ubuntu20Wsl2 = [65 ]int8 {52 , 46 , 49 , 57 , 46 , 49 , 50 , 56 , 45 , 109 , 105 , 99 , 114 , 111 , 115 , 111 , 102 , 116 , 45 , 115 , 116 , 97 , 110 , 100 , 97 , 114 , 100 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
172
-
173
- // Arch Linux on baremetal on 2021-04-02
174
- archReal = [65 ]int8 {53 , 46 , 49 , 49 , 46 , 49 , 49 , 45 , 97 , 114 , 99 , 104 , 49 , 45 , 49 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
175
- )
176
-
177
- result := isWsl (util.Syscall {
178
- Uname : func (buf * syscall.Utsname ) (err error ) {
179
- buf .Release = ubuntu20Wsl2
180
- return nil
181
- },
182
- })
183
- a .True (result )
184
-
185
- result = isWsl (util.Syscall {
186
- Uname : func (buf * syscall.Utsname ) (err error ) {
187
- buf .Release = archReal
188
- return nil
189
- },
190
- })
191
- a .False (result )
192
-
193
- result = isWsl (util.Syscall {
194
- Uname : func (buf * syscall.Utsname ) (err error ) {
195
- return errors .New ("mocked error" )
196
- },
197
- })
198
- a .False (result )
199
- }
0 commit comments