mirror of
https://github.com/go-delve/delve.git
synced 2025-10-28 20:53:42 +08:00
pkg,service: Optimized the display of examinemem command. (#1888)
1. Don't use intelligent '#' in fmt of go because it is not always satisfying for diffrent version of golang. Always keep one leading zero for octal and one leading '0x' for hex manually. Then keep alignment for every byte. 2. Always keep addr alignment when the lens of two adjacent address are different. Update #1814.
This commit is contained in:
@ -1009,13 +1009,13 @@ func TestExamineMemoryCmd(t *testing.T) {
|
||||
res := term.MustExec("examinemem -len 52 -fmt hex " + addressStr)
|
||||
t.Logf("the result of examining memory \n%s", res)
|
||||
// check first line
|
||||
firstLine := fmt.Sprintf("%#x: 0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x11", address)
|
||||
firstLine := fmt.Sprintf("%#x: 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11", address)
|
||||
if !strings.Contains(res, firstLine) {
|
||||
t.Fatalf("expected first line: %s", firstLine)
|
||||
}
|
||||
|
||||
// check last line
|
||||
lastLine := fmt.Sprintf("%#x: 0x3a 0x3b 0x3c 0x0", address+6*8)
|
||||
lastLine := fmt.Sprintf("%#x: 0x3a 0x3b 0x3c 0x00", address+6*8)
|
||||
if !strings.Contains(res, lastLine) {
|
||||
t.Fatalf("expected last line: %s", lastLine)
|
||||
}
|
||||
@ -1026,7 +1026,7 @@ func TestExamineMemoryCmd(t *testing.T) {
|
||||
t.Logf("the second result of examining memory result \n%s", res)
|
||||
|
||||
// check first line
|
||||
firstLine = fmt.Sprintf("%#x: 11111111 00001011 00001100 00001101", address)
|
||||
firstLine = fmt.Sprintf("%#x: 11111111 00001011 00001100 00001101", address)
|
||||
if !strings.Contains(res, firstLine) {
|
||||
t.Fatalf("expected first line: %s", firstLine)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user