Better testing infrastructure
Dependencies
- [2]
WQWRJHHFHandle Option<Hash> better - [3]
6GDPWAD2Parse Unhashed and Contents of Change - [4]
7VEHGTEYSwitch from reading text format to reading binary format. - [5]
EVHNGDT7parse FileAdd hunk - [6]
PHRWK7NKParse change headers - [7]
FBQT4QEBParse dependencies - [8]
4JWXOJIPParse dependencies
Change contents
- replacement in change_test.go at line 14[4.8822]→[4.8822:9091](∅→∅),[4.4983]→[4.692:701](∅→∅),[4.9091]→[4.692:701](∅→∅),[4.692]→[4.692:701](∅→∅),[4.701]→[4.429:699](∅→∅),[4.699]→[4.4998:5092](∅→∅),[4.5092]→[2.743:975](∅→∅),[2.975]→[4.5304:5331](∅→∅),[4.5304]→[4.5304:5331](∅→∅)
var CB7A3P_golden = Change{Version: 6,Message: "Say hello",Description: "a trivial change",Timestamp: time.Date(2023, 3, 27, 18, 51, 58, 26097601, time.UTC),Authors: []map[string]string{{"key": "BCEXYuKWaQ96btsk8UyBZWHLjn1Brhykv8tuZGPRjzFn",},},Dependencies: []Hash{Hash{0xe7, 0x82, 0xb1, 0xd7, 0xe4, 0x17, 0x64, 0xe4, 0xfe, 0x45, 0x2d, 0x6f, 0x24, 0x22, 0x40, 0x26, 0x16, 0x12, 0xb7, 0xf, 0x42, 0x70, 0xd9, 0xac, 0xd8, 0x4e, 0x5a, 0x82, 0xea, 0x85, 0xab, 0x57}},ExtraKnown: []Hash{},Metadata: []byte{},Changes: []Hunk{FileAdd{AddName: NewVertex{UpContext: []Position{Position{Change: OptionalHash{true, Hash{0xe7, 0x82, 0xb1, 0xd7, 0xe4, 0x17, 0x64, 0xe4, 0xfe, 0x45, 0x2d, 0x6f, 0x24, 0x22, 0x40, 0x26, 0x16, 0x12, 0xb7, 0x0f, 0x42, 0x70, 0xd9, 0xac, 0xd8, 0x4e, 0x5a, 0x82, 0xea, 0x85, 0xab, 0x57}},Pos: 0x1,},var changeTestCases = []struct {hash stringdata []byteparsed Change}{{hash: "CB7A3PP3XC6JY3QYUUNB4WCXGNFJMHTTH54MBAWBUVQL7TTHWBBQC",data: CB7A3P,parsed: Change{Version: 6,Message: "Say hello",Description: "a trivial change",Timestamp: time.Date(2023, 3, 27, 18, 51, 58, 26097601, time.UTC),Authors: []map[string]string{{"key": "BCEXYuKWaQ96btsk8UyBZWHLjn1Brhykv8tuZGPRjzFn", - edit in change_test.go at line 32[4.5338]→[4.5338:5458](∅→∅),[4.5458]→[2.976:1017](∅→∅),[2.1017]→[4.5479:5504](∅→∅),[4.5479]→[4.5479:5504](∅→∅)
DownContext: []Position{},Flag: 0x11,Start: 0x0,End: 0x1d,Inode: Position{Change: OptionalHash{true, Hash{}},Pos: 0x0,}, - replacement in change_test.go at line 33[4.5510]→[4.5510:5576](∅→∅),[4.5576]→[2.1018:1048](∅→∅),[2.1048]→[4.5598:5618](∅→∅),[4.5598]→[4.5598:5618](∅→∅)
AddInode: NewVertex{UpContext: []Position{Position{Change: OptionalHash{},Pos: 0x1d,Dependencies: []Hash{Hash{0xe7, 0x82, 0xb1, 0xd7, 0xe4, 0x17, 0x64, 0xe4, 0xfe, 0x45, 0x2d, 0x6f, 0x24, 0x22, 0x40, 0x26, 0x16, 0x12, 0xb7, 0xf, 0x42, 0x70, 0xd9, 0xac, 0xd8, 0x4e, 0x5a, 0x82, 0xea, 0x85, 0xab, 0x57}},ExtraKnown: []Hash{},Metadata: []byte{},Changes: []Hunk{FileAdd{AddName: NewVertex{UpContext: []Position{Position{Change: OptionalHash{true, Hash{0xe7, 0x82, 0xb1, 0xd7, 0xe4, 0x17, 0x64, 0xe4, 0xfe, 0x45, 0x2d, 0x6f, 0x24, 0x22, 0x40, 0x26, 0x16, 0x12, 0xb7, 0x0f, 0x42, 0x70, 0xd9, 0xac, 0xd8, 0x4e, 0x5a, 0x82, 0xea, 0x85, 0xab, 0x57}},Pos: 0x1,},},DownContext: []Position{},Flag: 0x11,Start: 0x0,End: 0x1d,Inode: Position{Change: OptionalHash{true, Hash{}},Pos: 0x0,}, - replacement in change_test.go at line 54[4.5626]→[4.5626:5754](∅→∅),[4.5754]→[2.1049:1090](∅→∅),[2.1090]→[4.5775:5872](∅→∅),[4.5775]→[4.5775:5872](∅→∅),[4.5872]→[2.1091:1121](∅→∅),[2.1121]→[4.5894:5914](∅→∅),[4.5894]→[4.5894:5914](∅→∅)
},DownContext: []Position{},Flag: 0x11,Start: 0x1e,End: 0x1e,Inode: Position{Change: OptionalHash{true, Hash{}},Pos: 0x0,},},Contents: NewVertex{UpContext: []Position{Position{Change: OptionalHash{},Pos: 0x1e,AddInode: NewVertex{UpContext: []Position{Position{Change: OptionalHash{},Pos: 0x1d,},},DownContext: []Position{},Flag: 0x11,Start: 0x1e,End: 0x1e,Inode: Position{Change: OptionalHash{true, Hash{}},Pos: 0x0,},},Contents: NewVertex{UpContext: []Position{Position{Change: OptionalHash{},Pos: 0x1e,},},DownContext: []Position{},Flag: 0x1,Start: 0x1f,End: 0x2c,Inode: Position{Change: OptionalHash{},Pos: 0x1e,}, - edit in change_test.go at line 86
Path: "hello",Encoding: "UTF-8", - replacement in change_test.go at line 89[4.5929]→[4.5929:6049](∅→∅),[4.6049]→[2.1122:1151](∅→∅),[2.1151]→[4.6070:6096](∅→∅),[4.6070]→[4.6070:6096](∅→∅)
DownContext: []Position{},Flag: 0x1,Start: 0x1f,End: 0x2c,Inode: Position{Change: OptionalHash{},Pos: 0x1e,},},ContentsHash: Hash{0x9e, 0xb3, 0xf7, 0x5c, 0x66, 0x9f, 0x18, 0xec, 0x4f, 0xf7, 0x30, 0x51, 0x42, 0xfe, 0x79, 0xbd, 0x52, 0x87, 0x24, 0x1, 0x1a, 0xc5, 0x77, 0xe8, 0xf9, 0x5b, 0x14, 0xd9, 0xee, 0xf7, 0x21, 0x48},Unhashed: map[string]any{"signature": "4cKLG1A2wd3pp6hBMaceFCGo8ADhUaDNz31MJeZxNFYnBf8yPepXfgor9o78y88ComC3b1YzDccucDbPbez9Ppxe", - replacement in change_test.go at line 94
Path: "hello",Encoding: "UTF-8",Contents: []byte{0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x01,0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x54, 0x46, 0x2d, 0x38, 0x00, 0x00, 0x68,0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x0a, 0x00,}, - edit in change_test.go at line 100
},ContentsHash: Hash{0x9e, 0xb3, 0xf7, 0x5c, 0x66, 0x9f, 0x18, 0xec, 0x4f, 0xf7, 0x30, 0x51, 0x42, 0xfe, 0x79, 0xbd, 0x52, 0x87, 0x24, 0x1, 0x1a, 0xc5, 0x77, 0xe8, 0xf9, 0x5b, 0x14, 0xd9, 0xee, 0xf7, 0x21, 0x48},Unhashed: map[string]any{"signature": "4cKLG1A2wd3pp6hBMaceFCGo8ADhUaDNz31MJeZxNFYnBf8yPepXfgor9o78y88ComC3b1YzDccucDbPbez9Ppxe",},Contents: []byte{0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x01,0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x54, 0x46, 0x2d, 0x38, 0x00, 0x00, 0x68,0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x0a, 0x00, - replacement in change_test.go at line 104
c, err := DeserializeChange(CB7A3P)if err != nil {t.Fatalf("deserialization error: %v", err)}if !reflect.DeepEqual(c, CB7A3P_golden) {t.Fatalf("got %s, want %s", spew.Sdump(c), spew.Sdump(CB7A3P_golden))for _, testCase := range changeTestCases {c, err := DeserializeChange(testCase.data)if err != nil {t.Errorf("%s: deserialization error: %v", testCase.hash, err)continue}if !reflect.DeepEqual(c, testCase.parsed) {t.Errorf("%s: got %s, want %s", testCase.hash, spew.Sdump(c), spew.Sdump(testCase.parsed))}