ssd1306: making unit test go 1.6 compatible

This commit is contained in:
Geoff Bourne 2017-09-02 08:32:57 -05:00
parent 903dc72cb7
commit 6e08978999
1 changed files with 34 additions and 30 deletions

View File

@ -37,7 +37,8 @@ func TestBufferHoriz_On(t *testing.T) {
pages := uint(2) // height = 16
for _, tt := range onTests {
t.Run(tt.name, func(t *testing.T) {
// Disabling testing Run use since this needs to build in go 1.6 also
//t.Run(tt.name, func(t *testing.T) {
buffer := newBufferHoriz(width, pages)
buffer.On(tt.x, tt.y)
@ -45,7 +46,7 @@ func TestBufferHoriz_On(t *testing.T) {
if !reflect.DeepEqual(buffer.cells, tt.expected) {
t.Errorf("%s: wrong cell content, saw %v", tt.name, buffer.cells)
}
})
//})
}
}
@ -54,14 +55,15 @@ func TestBufferHoriz_Set(t *testing.T) {
pages := uint(2) // height = 16
for _, tt := range onTests {
t.Run(tt.name, func(t *testing.T) {
// Disabling testing Run use since this needs to build in go 1.6 also
//t.Run(tt.name, func(t *testing.T) {
buffer := newBufferHoriz(width, pages)
buffer.Set(tt.x, tt.y, true)
if !reflect.DeepEqual(buffer.cells, tt.expected) {
t.Errorf("%s: wrong cell content, saw %v", tt.name, buffer.cells)
}
})
//})
}
}
@ -82,7 +84,8 @@ func TestBufferHoriz_FillRect(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Disabling testing Run use since this needs to build in go 1.6 also
//t.Run(tt.name, func(t *testing.T) {
buffer := newBufferHoriz(width, pages)
buffer.FillRect(tt.x, tt.y, tt.width, tt.height)
@ -90,7 +93,7 @@ func TestBufferHoriz_FillRect(t *testing.T) {
if !reflect.DeepEqual(buffer.cells, tt.expected) {
t.Errorf("%s: wrong cell content, saw %v", tt.name, buffer.cells)
}
})
//})
}
}
@ -109,7 +112,8 @@ func TestBufferHoriz_Off(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
// Disabling testing Run use since this needs to build in go 1.6 also
//t.Run(tt.name, func(t *testing.T) {
buffer := newBufferHoriz(width, pages)
// assumes TestBufferHoriz_FillRect passes
@ -121,6 +125,6 @@ func TestBufferHoriz_Off(t *testing.T) {
t.Errorf("%s: wrong cell content, saw %v", tt.name, buffer.cells)
}
})
//})
}
}