github.com/elliott5/community@v0.14.1-0.20160709191136-823126fb026a/wordsmith/utility/user_test.go (about)

     1  // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved.
     2  //
     3  // This software (Documize Community Edition) is licensed under 
     4  // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html
     5  //
     6  // You can operate outside the AGPL restrictions by purchasing
     7  // Documize Enterprise Edition and obtaining a commercial license
     8  // by contacting <sales@documize.com>. 
     9  //
    10  // https://documize.com
    11  
    12  package utility
    13  
    14  import "testing"
    15  
    16  func TestInitials(t *testing.T) {
    17  	in(t, "Harvey", "Kandola", "HK")
    18  	in(t, "Harvey", "", "H")
    19  	in(t, "", "Kandola", "K")
    20  	in(t, "", "", "")
    21  }
    22  
    23  func in(t *testing.T, firstname, lastname, expecting string) {
    24  	initials := MakeInitials(firstname, lastname)
    25  	if initials != expecting {
    26  		t.Errorf("expecting initials of `%s` got `%s`\n", expecting, initials)
    27  	}
    28  }