-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename and lisibility change in test
* change in template to make it more easy to pickup
- Loading branch information
1 parent
e22e973
commit f8f3c30
Showing
9 changed files
with
106 additions
and
126 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package parser | ||
package markuplanguages | ||
|
||
import ( | ||
"errors" | ||
|
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
2 changes: 1 addition & 1 deletion
2
internal/parser/markdown.go → internal/markup_languages/markdown.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package parser | ||
package markuplanguages | ||
|
||
import ( | ||
"errors" | ||
|
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,89 @@ | ||
package markuplanguages | ||
|
||
import ( | ||
"fmt" | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
func TestParse(t *testing.T) { | ||
t.Run("Happy path should return the wanted struct", func (t *testing.T) { | ||
input := ` | ||
# Title | ||
## Skill | ||
### Date | ||
#### Url | ||
Item | ||
Item2` | ||
result, err := Parse(input) | ||
if err != nil { | ||
t.Fatalf("Unexecpted eroor :%s", err.Error()) | ||
} | ||
|
||
first := "Title" | ||
if result.first != first { | ||
t.Fatalf("want %s got %s", first, result.first) | ||
} | ||
|
||
|
||
second := "Skill" | ||
if result.second != second { | ||
t.Fatalf("want %s got %s", second, result.second) | ||
} | ||
|
||
third := "Date" | ||
if result.third != third { | ||
t.Fatalf("want %s got %s", third, result.third) | ||
} | ||
|
||
fourth := "Url" | ||
if result.fourth != fourth { | ||
t.Fatalf("want %s got %s", fourth, result.fourth) | ||
} | ||
|
||
|
||
description := []string{"Item","Item2"} | ||
if !reflect.DeepEqual(result.description, description){ | ||
fmt.Printf("want: %q, got: %q\n", description, result.description) | ||
t.Fatalf("want %s got %s", description, result.description) | ||
} | ||
}) | ||
|
||
t.Run("should return an error if title is badly formarted", func (t *testing.T) { | ||
input := ` | ||
#Title | ||
## Skill | ||
### Date | ||
#### Url | ||
Description` | ||
_, err := Parse(input) | ||
want := "Err: cannot parse this md line{#Title} # should be followed by space" | ||
|
||
if err == nil { | ||
t.Fatalf("expected an error") | ||
} | ||
|
||
if err.Error() != want { | ||
t.Fatalf("should return a formating error, got %s should %s",err.Error(),want) | ||
} | ||
|
||
}) | ||
t.Run("should return an error if outside of allowed nb of #", func (t *testing.T) { | ||
input := ` | ||
# Title | ||
## Skill | ||
### Date | ||
#### Url | ||
##### oups | ||
Description` | ||
_, err := Parse(input) | ||
want := "Err: cannot parse this md line{##### oups}" | ||
|
||
if err == nil { | ||
t.Fatalf("expected an error") | ||
} | ||
if err.Error() != want { | ||
t.Fatalf("should return a formating error, got %s should %s",err.Error(),want) | ||
} | ||
}) | ||
} |
2 changes: 1 addition & 1 deletion
2
internal/parser/template_sections.go → ...nal/markup_languages/template_sections.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package parser | ||
package markuplanguages | ||
|
||
const pro_item = "\\resumeItem{%ITEM%}\n" | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.