-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from linkdata/pass-jid-to-all-eventfn
add jid parameter to event functions
- Loading branch information
Showing
6 changed files
with
90 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package what | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
func TestParse(t *testing.T) { | ||
lastWhat := What(len(_What_index) - 2) | ||
tests := []struct { | ||
name string | ||
arg string | ||
want What | ||
}{ | ||
{"blank is None", "", None}, | ||
{"Inner", "Inner", Inner}, | ||
{"inner", "inner", Inner}, | ||
{"innerr", "innerr", None}, | ||
{"last", lastWhat.String(), lastWhat}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := Parse(tt.arg); got != tt.want { | ||
t.Errorf("Parse() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func TestString(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
arg What | ||
want string | ||
}{ | ||
{"None", None, "None"}, | ||
{"Inner", Inner, "Inner"}, | ||
{"unknown", What(len(_What_index) + 44), fmt.Sprintf("What(%d)", len(_What_index)+44)}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := tt.arg.String(); got != tt.want { | ||
t.Errorf("%v.String() = %q, want %q", tt.arg, got, tt.want) | ||
} | ||
}) | ||
} | ||
} |