Skip to content

Commit

Permalink
clean up support for quotes in strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Marquette committed Mar 16, 2019
1 parent f1f0439 commit 2960834
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions PSGraph/Private/Format-Value.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ function Format-Value
{
"<$PSItem>"
}
'^".*"$'
{
[string]$PSItem
}
# Anything else, use quotes
default
{
Expand Down
4 changes: 4 additions & 0 deletions Tests/Edge.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ Describe 'Function Edge' {
Edge "Data1:R1" -To "Data2:R2" | Should -Match ([regex]::escape('"Data1":R1->"Data2":R2'))
}

It "should handle quoted record labels in edges" {
Edge '"Data1:R1"' -To '"Data2:R2"' | Should -Match ([regex]::escape('"Data1:R1"->"Data2:R2"'))
}

It "should handle URLs for edges" {
Edge "http://data1.com" -To "http://data2.com" | Should -Match ([regex]::escape('"http://data1.com"->"http://data2.com"'))
}
Expand Down
4 changes: 4 additions & 0 deletions Tests/Node.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ Describe 'Function Node' -Tag Build {
It "should handle URLs for nodes" {
Node "http://data.com" | Should -Match ([regex]::escape('"http://data.com"'))
}

It "should handle quotes around values" {
Node '"http://data.com"' | Should -Match ([regex]::escape('"http://data.com"'))
}
}

}

0 comments on commit 2960834

Please sign in to comment.