-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrevert_test.go
56 lines (47 loc) · 1.33 KB
/
revert_test.go
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
53
54
55
56
package p4
import (
"fmt"
"os"
"strings"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestConn_Revert(t *testing.T) {
var (
err error
conn *Conn
)
conn, err = setup(t)
Convey("test Revert", t, func() {
So(err, ShouldBeNil)
// 查询stream
stream, err := conn.ChangeListStream(15585)
So(stream, ShouldNotBeEmpty)
So(err, ShouldBeNil)
// 创建临时partitioned workspace
streamWs := strings.Trim(stream, "/")
// root_DM99.ZGame.Project-Development-xiner_test
client := "root" + "_" + strings.ReplaceAll(streamWs, "/", "-")
wsRoot, _ := os.Getwd()
clientInfo := Client{
Client: client,
Owner: "root",
Root: wsRoot + "/" + client,
Options: "noallwrite noclobber nocompress unlocked nomodtime normdir",
SubmitOptions: "submitunchanged",
Stream: stream,
View: []string{fmt.Sprintf("%s/... //%s/...", stream, client)},
}
message, err := conn.CreatePartitionClient(clientInfo)
So(message, ShouldNotBeEmpty)
// Client root_DM99.ZGame.Project-Development-xiner_test saved.
//So(message, ShouldEqual, fmt.Sprintf("Client %s saved.", client))
So(err, ShouldBeNil)
conn = conn.SetClient(client)
Convey("Describe Shelved", func() {
message, err = conn.Revert(15585)
So(message, ShouldNotBeNil)
So(err, ShouldBeNil)
})
})
}