Пример #1
0
func Test_Blue_1(t *testing.T) {
	expected := "\x1b[34mpolru\x1b[39;49m"
	actual := Color.Blue("polru", true)
	if actual != expected {
		t.Errorf("Test failed, expected: '%s', got: '%s'", expected, actual)
	}
}
Пример #2
0
func Test_Blue_2(t *testing.T) {
	expected := "polru"
	actual := Color.Blue("polru", false)
	if actual != expected {
		t.Errorf("Test failed, expected: '%s', got: '%s'", expected, actual)
	}
}
Пример #3
0
func printSummary(user anaconda.User, color bool) {
	fmt.Print(" ", user.Name)
	fmt.Printf("(%s)", Color.Blue(user.ScreenName, color))
	fmt.Print("     id:", Color.Blue(user.IdStr, color))
	fmt.Print("\n")
	fmt.Print(" ", user.Name)
	if user.GeoEnabled {
		fmt.Printf(" has geolocation %s\n", Color.Green("enabled", color))
	} else {
		fmt.Printf(" has geolocation %s\n", Color.Magenta("disabled", color))
	}
	locale := ""
	location := user.Location
	if "" != location {
		locale += "Location:  " + Color.Green(location, color) + ";     "
	}
	timezone := user.TimeZone
	if "" != timezone {
		locale += "Timezone: " + Color.Green(timezone, color) + ";     "
	}
	language := user.Lang
	if "" != language {
		locale += "Language: " + Color.Green(language, color) + ";"
	}
	if "" != locale {
		fmt.Printf(" %s\n", locale)
	}
	fmt.Printf(" Created: %s\n", Color.Green(user.CreatedAt, color))
	fmt.Printf(" URL: %s\n", Color.Yellow(user.URL, color))
	fmt.Printf(" Profile Image: %s\n", Color.Yellow(user.ProfileImageURL, color))
	fmt.Printf(" %v favorites;     %v friends;     %v followers;\n", user.FriendsCount, user.FavouritesCount, user.FollowersCount)
	fmt.Printf(" Member of %v public lists\n", user.ListedCount)
	numberOfTweets := user.StatusesCount
	fmt.Printf(" Number of Tweets: %v\n", numberOfTweets)
	if numberOfTweets > 0 {
		fmt.Printf(" Most Recent Tweet: %s\n", user.Status.Text)
	}
}