Skip to content

Commit

Permalink
d2cli: Move main code into d2cli so it can be imported from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nhooyr committed Feb 27, 2023
1 parent 233a3fd commit 23a2896
Show file tree
Hide file tree
Showing 10 changed files with 595 additions and 555 deletions.
34 changes: 34 additions & 0 deletions cli-e2etests/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main_test

import (
"context"
"testing"
"time"
)

func TestCLI_E2E(t *testing.T) {
t.Parallel()

tca := []struct {
name string
run func(t *testing.T, ctx context.Context)
}{
{
name: "hello_world",
run: func(t *testing.T, ctx context.Context) {},
},
}

ctx := context.Background()
for _, tc := range tca {
tc := tc
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

ctx, cancel := context.WithTimeout(ctx, time.Minute*5)
defer cancel()

tc.run(t, ctx)
})
}
}
2 changes: 1 addition & 1 deletion fmt.go → d2cli/fmt.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package d2cli

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion help.go → d2cli/help.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package d2cli

import (
"context"
Expand Down
Loading

0 comments on commit 23a2896

Please sign in to comment.