MCPcopy Create free account
hub / github.com/exercism/cli / TestExerciseMetadataString

Function TestExerciseMetadataString

workspace/exercise_metadata_test.go:87–147  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

85}
86
87func TestExerciseMetadataString(t *testing.T) {
88 testCases := []struct {
89 metadata ExerciseMetadata
90 desc string
91 }{
92 {
93 metadata: ExerciseMetadata{
94 Track: "elixir",
95 ExerciseSlug: "secret-handshake",
96 Handle: "",
97 Dir: "",
98 },
99 desc: "elixir/secret-handshake",
100 },
101 {
102 metadata: ExerciseMetadata{
103 Track: "cpp",
104 ExerciseSlug: "clock",
105 Handle: "alice",
106 IsRequester: true,
107 },
108 desc: "cpp/clock",
109 },
110 {
111 metadata: ExerciseMetadata{
112 Track: "cpp",
113 ExerciseSlug: "clock",
114 Handle: "alice",
115 IsRequester: true,
116 Dir: "/path/to/clock-2",
117 },
118 desc: "cpp/clock (2)",
119 },
120 {
121 metadata: ExerciseMetadata{
122 Track: "fsharp",
123 ExerciseSlug: "hello-world",
124 Handle: "bob",
125 IsRequester: false,
126 },
127 desc: "fsharp/hello-world by @bob",
128 },
129 {
130 metadata: ExerciseMetadata{
131 Track: "haskell",
132 ExerciseSlug: "allergies",
133 Handle: "charlie",
134 IsRequester: false,
135 Dir: "/path/to/allergies-2",
136 },
137 desc: "haskell/allergies (2) by @charlie",
138 },
139 }
140
141 for _, tc := range testCases {
142 testName := "should stringify to '" + tc.desc + "'"
143 t.Run(testName, func(t *testing.T) {
144 assert.Equal(t, tc.desc, tc.metadata.String())

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected