cat / 012
clone

a spreadsheet for the terminal: lotus 1-2-3 looks, google sheets keys and formulas, one go binary

Headless opens read linked sources in the workbook's folder; describe names sources

Dami committed 3f36d96
commit
3f36d964b8fa781fa6b3a6d687bde9e96eb16594
parent
68d3ceb24a74d7c64a8aa13408fd04341f1f6787
author
Dami <dami.etoile@gmail.com>
kind
feat risk score 1.9 of 3, Jev's estimate
8 files changed, +121 -16
Minternal/headless/describe.go11+++++-
Minternal/headless/describe_test.go2+-
Minternal/headless/describetext.go7+++-
Minternal/headless/headless.go2+
Ainternal/headless/sources.go36++++++++++++++++++++
Ainternal/headless/sources_test.go54++++++++++++++++++++++++++++++
Minternal/paged/host_test.go17++++++----
Minternal/paged/link.go8++--
M internal/headless/describe.go +9 -2
M internal/headless/describe_test.go +1 -1
M internal/headless/describetext.go +5 -2
M internal/headless/headless.go +2 -0
A internal/headless/sources.go +36 -0
A internal/headless/sources_test.go +54 -0
M internal/paged/host_test.go +10 -7
@@ -83,7 +83,7 @@ func linked(t *testing.T, name string, budget int) (*sheet.Workbook, *Host) {
8383 t.Fatal(err)8484 }8585 h := NewHost(budget)86- h.Settle(context.Background(), w, func(p string) string { return p })86+ h.Settle(context.Background(), w, Links(w, same, ""))8787 return w, h8888 }8989
@@ -119,7 +119,7 @@ func TestFormulasOverASource(t *testing.T) {
119119 t.Fatalf("%s: %v", f, err)120120 }121121 }122- h.Settle(context.Background(), w, func(p string) string { return p })122+ h.Settle(context.Background(), w, Links(w, same, ""))123123 for i, f := range sameFormulas {124124 got, want := s.Value(sheet.Addr{Col: 10, Row: i}), s.Value(sheet.Addr{Col: 11, Row: i})125125 if testing.Verbose() {
@@ -174,7 +174,7 @@ func TestPastTheBudget(t *testing.T) {
174174 med, sum := sheet.Addr{Col: 10}, sheet.Addr{Col: 10, Row: 1}175175 s.Set(med, "=MEDIAN(sales[amount])")176176 s.Set(sum, "=SUM(sales[amount])")177- h.Settle(context.Background(), w, func(p string) string { return p })177+ h.Settle(context.Background(), w, Links(w, same, ""))178178 if v := s.Value(med); v != sheet.ErrValue {179179 t.Errorf("MEDIAN past the budget: %v, want #VALUE!", v)180180 }
@@ -208,7 +208,7 @@ func TestPivotOverASource(t *testing.T) {
208208 if err != nil {209209 t.Fatal(err)210210 }211- h.Settle(context.Background(), w, func(p string) string { return p })211+ h.Settle(context.Background(), w, Links(w, same, ""))212212 wb, _ := want.UsedRange()213213 gb, _ := got.UsedRange()214214 if wb != gb {
@@ -232,7 +232,7 @@ func TestSourceChanges(t *testing.T) {
232232 s := w.Sheet(0)233233 a := sheet.Addr{Col: 10}234234 s.Set(a, "=SUM(sales[amount])")235- h.Settle(context.Background(), w, func(p string) string { return p })235+ h.Settle(context.Background(), w, Links(w, same, ""))236236 before := s.Value(a)237237 now := time.Now()238238 h.Now = func() time.Time { return now }
@@ -244,7 +244,7 @@ func TestSourceChanges(t *testing.T) {
244244 if !h.Poll() {245245 t.Fatal("a changed file isn't read again")246246 }247- h.Settle(context.Background(), w, func(p string) string { return p })247+ h.Settle(context.Background(), w, Links(w, same, ""))248248 after := s.Value(a)249249 if after.Kind != sheet.Number || after.Num-before.Num < 80 {250250 t.Errorf("SUM %v before the file changed, %v after", before, after)
@@ -259,7 +259,7 @@ func TestMissingSource(t *testing.T) {
259259 }260260 a := sheet.Addr{}261261 s.Set(a, "=SUM(gone[x])")262- NewHost(1000).Settle(context.Background(), w, func(p string) string { return p })262+ NewHost(1000).Settle(context.Background(), w, Links(w, same, ""))263263 if v := s.Value(a); v != sheet.ErrRef {264264 t.Errorf("a missing source: %v, want #REF!", v)265265 }
@@ -267,3 +267,6 @@ func TestMissingSource(t *testing.T) {
267267 t.Errorf("explained as %q", why)268268 }269269 }270+271+// same is a path as it is: the tests' files are named whole.272+func same(p string) string { return p }
M internal/paged/link.go +4 -4