You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: text_test.go
    path of file: ./repos/termdash/widgets/text
    
    the code of the file until where you have to start completion: // Copyright 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES O
    
func TestTruncateToCells(t *testing.T) {
	tests := []struct {
		desc     string
		text     string
		maxCells int
		want     string
	}{
		{
			desc:     "returns empty on empty text",
			text:     "",
			maxCells: 0,
			want:     "",
		},
		{
			desc:     "no need to truncate, length matches max",
			text:     "a",
			maxCells: 1,
			want:     "a",
		},
		{
			desc:     "no need to truncate, shorter than max",
			text:     "a",
			maxCells: 2,
			want:     "a",
		},
		{
			desc:     "no need to truncate, maxCells set to zero",
			text:     "a",
			maxCells: 0,
			want:     "a",
		},
		{
			desc:     "truncates single rune to enforce max cells",
			text:     "abc",
			maxCells: 2,
			want:     "bc",
		},
		{
			desc:     "truncates multiple runes to enforce max cells",
			text:     "abcde",
			maxCells: 3,
			want:     "cde",
		},
		{
			desc:     "accounts for cells taken by newline characters",
			text:     "a\ncde",
			maxCells: 3,
			want:     "cde",
		},
		{
			desc:     "truncates full-width rune on its edge",
			text:     "世界",
			maxCells: 2,
			want:     "界",
		},
		{
			desc:     "truncates full-width rune because only half of it fits",
			text:     "世界",
			maxCells: 3,
			want:     "界",
		},
		{
			desc:     "full-width runes - truncating not needed",
			text:     "世界",
			maxCells: 4,
			want:     "世界",
		},
	}

	for _, tc := range tests {
		t.Run(tc.desc, func(t *testing.T) {
			got := truncateToCells(tc.text, tc.maxCells)
			if diff := pretty.Compare(tc.want, got); diff != "" {
				t.Errorf("truncateToCells => unexpected diff (-want, +got):\n%s", diff)
			}
		})
	}
}