GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — lankir/main_test.go at master · Matbe34/lankir

Expand file tree

/

main_test.go

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
52 lines (47 loc) · 2.02 KB
/

main_test.go

Copy path

File metadata and controls

52 lines (47 loc) · 2.02 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"reflect"
"testing"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/Matbe34/lankir/internal/config"
)
// The Hardware acceleration setting picks WebKit's acceleration policy.
func TestWebviewGpuPolicy(t *testing.T) {
if got := webviewGpuPolicy(&config.Config{HardwareAccel: true}); got != application.WebviewGpuPolicyAlways {
t.Errorf("hardwareAccel on: policy %v, want always", got)
}
if got := webviewGpuPolicy(&config.Config{HardwareAccel: false}); got != application.WebviewGpuPolicyNever {
t.Errorf("hardwareAccel off: policy %v, want never", got)
}
}
func TestParseArgs(t *testing.T) {
cases := []struct {
name string
args []string
wantCLI []string
wantGUI []string
}{
{"no args", nil, nil, nil},
{"cobra subcommand", []string{"pdf", "info", "x.pdf"}, []string{"pdf", "info", "x.pdf"}, nil},
{"single pdf path", []string{"foo.pdf"}, nil, []string{"foo.pdf"}},
{"multiple pdf paths", []string{"a.pdf", "b.pdf"}, nil, []string{"a.pdf", "b.pdf"}},
{"global flag before subcommand", []string{"--verbose", "pdf", "info", "x.pdf"}, []string{"--verbose", "pdf", "info", "x.pdf"}, nil},
{"dot-slash workaround", []string{"./pdf"}, nil, []string{"./pdf"}},
{"completion subcommand", []string{"completion", "bash"}, []string{"completion", "bash"}, nil},
{"help subcommand", []string{"help"}, []string{"help"}, nil},
{"shell completion request", []string{"__complete", "pdf", ""}, []string{"__complete", "pdf", ""}, nil},
{"shell completion request without descriptions", []string{"__completeNoDesc", "pdf", ""}, []string{"__completeNoDesc", "pdf", ""}, nil},
{"unknown subcommand routes to GUI", []string{"pdf-info", "x.pdf"}, nil, []string{"pdf-info", "x.pdf"}},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
cli, gui := parseArgs(tc.args)
if !reflect.DeepEqual(cli, tc.wantCLI) {
t.Errorf("CLI: got %v want %v", cli, tc.wantCLI)
}
if !reflect.DeepEqual(gui, tc.wantGUI) {
t.Errorf("GUI: got %v want %v", gui, tc.wantGUI)
}
})
}
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.