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 f64b5c0 commit 8ff1d6d
Show file tree
Hide file tree
Showing 8 changed files with 595 additions and 558 deletions.
30 changes: 30 additions & 0 deletions cli-e2etests/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package main_test

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

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

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 8ff1d6d

Please sign in to comment.