@@ -30,6 +30,24 @@ func Test_processFiles(t *testing.T) {
3030 assert .Equal (t , "hey cool how is it going" , files ["gistfile0.txt" ])
3131}
3232
33+ func Test_guessGistName_stdin (t * testing.T ) {
34+ files := map [string ]string {"gistfile0.txt" : "sample content" }
35+
36+ gistName := guessGistName (files )
37+ assert .Equal (t , "" , gistName )
38+ }
39+
40+ func Test_guessGistName_userFiles (t * testing.T ) {
41+ files := map [string ]string {
42+ "fig.txt" : "I am a fig." ,
43+ "apple.txt" : "I am an apple." ,
44+ "gistfile0.txt" : "sample content" ,
45+ }
46+
47+ gistName := guessGistName (files )
48+ assert .Equal (t , "apple.txt" , gistName )
49+ }
50+
3351func TestNewCmdCreate (t * testing.T ) {
3452 tests := []struct {
3553 name string
@@ -157,7 +175,7 @@ func Test_createRun(t *testing.T) {
157175 Filenames : []string {fixtureFile },
158176 },
159177 wantOut : "https://gist.github.com/aa5a315d61ae9438b18d\n " ,
160- wantStderr : "- Creating gist... \n ✓ Created gist\n " ,
178+ wantStderr : "- Creating gist fixture.txt \n ✓ Created gist fixture.txt \n " ,
161179 wantErr : false ,
162180 wantParams : map [string ]interface {}{
163181 "public" : true ,
@@ -175,7 +193,7 @@ func Test_createRun(t *testing.T) {
175193 Filenames : []string {fixtureFile },
176194 },
177195 wantOut : "https://gist.github.com/aa5a315d61ae9438b18d\n " ,
178- wantStderr : "- Creating gist... \n ✓ Created gist\n " ,
196+ wantStderr : "- Creating gist fixture.txt \n ✓ Created gist fixture.txt \n " ,
179197 wantErr : false ,
180198 wantParams : map [string ]interface {}{
181199 "description" : "an incredibly interesting gist" ,
@@ -193,7 +211,7 @@ func Test_createRun(t *testing.T) {
193211 },
194212 stdin : "cool stdin content" ,
195213 wantOut : "https://gist.github.com/aa5a315d61ae9438b18d\n " ,
196- wantStderr : "- Creating gist... \n ✓ Created gist\n " ,
214+ wantStderr : "- Creating gist with multiple files \n ✓ Created gist fixture.txt \n " ,
197215 wantErr : false ,
198216 wantParams : map [string ]interface {}{
199217 "files" : map [string ]interface {}{
0 commit comments