File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,10 @@ package quickfix
33import (
44 "bufio"
55 "fmt"
6- "github.com/quickfixgo/quickfix/config"
76 "io"
87 "regexp"
8+
9+ "github.com/quickfixgo/quickfix/config"
910)
1011
1112//The Settings type represents a collection of global and session settings.
@@ -67,7 +68,7 @@ func ParseSettings(reader io.Reader) (*Settings, error) {
6768 commentRegEx := regexp .MustCompile (`^#.*` )
6869 defaultRegEx := regexp .MustCompile (`^\[(?i)DEFAULT\]\s*$` )
6970 sessionRegEx := regexp .MustCompile (`^\[(?i)SESSION\]\s*$` )
70- settingRegEx := regexp .MustCompile (`^(. *)=(.*)$` )
71+ settingRegEx := regexp .MustCompile (`^([^=] *)=(.*)$` )
7172
7273 var settings * SessionSettings
7374
Original file line number Diff line number Diff line change 11package quickfix
22
33import (
4- "github.com/quickfixgo/quickfix/config"
54 "strings"
65 "testing"
6+
7+ "github.com/quickfixgo/quickfix/config"
8+ "github.com/stretchr/testify/assert"
9+ "github.com/stretchr/testify/require"
710)
811
912func TestSettings_New (t * testing.T ) {
@@ -266,6 +269,27 @@ DataDictionary=somewhere/FIX42.xml
266269 }
267270}
268271
272+ func TestSettings_ParseSettings_WithEqualsSignInValue (t * testing.T ) {
273+ s , err := ParseSettings (strings .NewReader (`
274+ [DEFAULT]
275+ ConnectionType=initiator
276+ SQLDriver=mysql
277+ SQLDataSourceName=root:root@/quickfix?parseTime=true&loc=UTC
278+
279+ [SESSION]
280+ BeginString=FIX.4.2
281+ SenderCompID=SENDER
282+ TargetCompID=TARGET` ))
283+
284+ require .Nil (t , err )
285+ require .NotNil (t , s )
286+
287+ sessionSettings := s .SessionSettings ()[SessionID {BeginString : "FIX.4.2" , SenderCompID : "SENDER" , TargetCompID : "TARGET" }]
288+ val , err := sessionSettings .Setting ("SQLDataSourceName" )
289+ assert .Nil (t , err )
290+ assert .Equal (t , `root:root@/quickfix?parseTime=true&loc=UTC` , val )
291+ }
292+
269293func TestSettings_SessionIDFromSessionSettings (t * testing.T ) {
270294 var testCases = []struct {
271295 globalBeginString string
You can’t perform that action at this time.
0 commit comments