Skip to content

Commit

Permalink
Merge 7faa010 into 42f5d61
Browse files Browse the repository at this point in the history
  • Loading branch information
mum4k committed Jun 20, 2020
2 parents 42f5d61 + 7faa010 commit e622d83
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -14,7 +14,7 @@ script:
- diff -u <(echo -n) <(./internal/scripts/autogen_licences.sh .)
- diff -u <(echo -n) <(golint ./...)
after_success:
- ./internal/scripts/coverage.sh
- ./private/scripts/coverage.sh
env:
global:
- CGO_ENABLED=0
- CGO_ENABLED=0
12 changes: 11 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.12.1] - 20-Jun-2020

### Fixed

- the `tcell` unit test can now pass in headless mode (when TERM="") which
happens under bazel.
- fixed path to the coverage script after the rename if directory "internal" to
"private".

## [0.12.0] - 10-Apr-2020

### Added
Expand Down Expand Up @@ -325,7 +334,8 @@ identifiers shouldn't be used externally.
- The Gauge widget.
- The Text widget.

[unreleased]: https://github.com/mum4k/termdash/compare/v0.12.0...devel
[unreleased]: https://github.com/mum4k/termdash/compare/v0.12.1...devel
[0.12.1]: https://github.com/mum4k/termdash/compare/v0.12.0...v0.12.1
[0.12.0]: https://github.com/mum4k/termdash/compare/v0.11.0...v0.12.0
[0.11.0]: https://github.com/mum4k/termdash/compare/v0.10.0...v0.11.0
[0.10.0]: https://github.com/mum4k/termdash/compare/v0.9.1...v0.10.0
Expand Down
8 changes: 6 additions & 2 deletions terminal/tcell/tcell.go
Expand Up @@ -16,6 +16,7 @@ package tcell

import (
"context"
"fmt"
"image"

"github.com/gdamore/tcell"
Expand Down Expand Up @@ -79,11 +80,14 @@ type Terminal struct {
clearStyle *cell.Options
}

// tcellNewScreen can be overridden from tests.
var tcellNewScreen = tcell.NewScreen

// newTerminal creates the terminal and applies the options.
func newTerminal(opts ...Option) (*Terminal, error) {
screen, err := tcell.NewScreen()
screen, err := tcellNewScreen()
if err != nil {
return nil, err
return nil, fmt.Errorf("tcell.NewScreen => %v", err)
}

t := &Terminal{
Expand Down
5 changes: 5 additions & 0 deletions terminal/tcell/tcell_test.go
Expand Up @@ -17,6 +17,7 @@ package tcell
import (
"testing"

"github.com/gdamore/tcell"
"github.com/kylelemons/godebug/pretty"
"github.com/mum4k/termdash/cell"
"github.com/mum4k/termdash/terminal/terminalapi"
Expand Down Expand Up @@ -45,11 +46,13 @@ func TestNewTerminalColorMode(t *testing.T) {
},
}

tcellNewScreen = func() (tcell.Screen, error) { return nil, nil }
for _, tc := range tests {
t.Run(tc.desc, func(t *testing.T) {
got, err := newTerminal(tc.opts...)
if err != nil {
t.Errorf("newTerminal => unexpected error:\n%v", err)
return
}

// Ignore these fields.
Expand Down Expand Up @@ -96,11 +99,13 @@ func TestNewTerminalClearStyle(t *testing.T) {
},
}

tcellNewScreen = func() (tcell.Screen, error) { return nil, nil }
for _, tc := range tests {
t.Run(tc.desc, func(t *testing.T) {
got, err := newTerminal(tc.opts...)
if err != nil {
t.Errorf("newTerminal => unexpected error:\n%v", err)
return
}

// Ignore these fields.
Expand Down

0 comments on commit e622d83

Please sign in to comment.