Skip to content

Commit

Permalink
Fix period escaping.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmrtt authored and awalterschulze committed Oct 4, 2020
1 parent d1b7d4b commit 909238c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions escape.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ func isID(s string) bool {
if c == '/' {
return false
}
if c == '.' {
return false
}
i++
}
return pos
Expand Down
12 changes: 12 additions & 0 deletions escape_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,23 @@ func TestEscape(t *testing.T) {
if err := g.AddNode("asdf asdf", "a/b", nil); err != nil {
t.Fatal(err)
}
if err := g.AddNode("asdf asdf", "c.d", nil); err != nil {
t.Fatal(err)
}
if err := g.AddNode("asdf asdf", "e-f", nil); err != nil {
t.Fatal(err)
}
if err := g.AddNode("asdf asdf", "12_34", nil); err != nil {
t.Fatal(err)
}
s := g.String()
if !strings.HasPrefix(s, `digraph "asdf adsf" {
"kasdf99 99"->7;
"12_34";
"a << b";
"a/b";
"c.d";
"e-f";
"kasdf99 99" [ URL="<a" ];
7 [ URL="<a" ];
Expand Down

0 comments on commit 909238c

Please sign in to comment.