@@ -137,6 +137,27 @@ func TestFQBN(t *testing.T) {
137137 require .Equal (t ,
138138 "properties.Map{\n \" cpu\" : \" atmega\" ,\n \" speed\" : \" 1000\" ,\n \" extra\" : \" core=arduino\" ,\n }" ,
139139 f .Configs .Dump ())
140+
141+ // Check invalid characters in config keys
142+ _ , err = fqbn .Parse ("arduino:avr:uno:cpu@=atmega" )
143+ require .Error (t , err )
144+ _ , err = fqbn .Parse ("arduino:avr:uno:cpu@atmega" )
145+ require .Error (t , err )
146+ _ , err = fqbn .Parse ("arduino:avr:uno:cpu=atmega,speed@=1000" )
147+ require .Error (t , err )
148+ _ , err = fqbn .Parse ("arduino:avr:uno:cpu=atmega,speed@1000" )
149+ require .Error (t , err )
150+
151+ // Check invalid characters in config values
152+ _ , err = fqbn .Parse ("arduino:avr:uno:cpu=atmega@" )
153+ require .Error (t , err )
154+ _ , err = fqbn .Parse ("arduino:avr:uno:cpu=atmega@extra" )
155+ require .Error (t , err )
156+ _ , err = fqbn .Parse ("arduino:avr:uno:cpu=atmega,speed=1000@" )
157+ require .Error (t , err )
158+ _ , err = fqbn .Parse ("arduino:avr:uno:cpu=atmega,speed=1000@extra" )
159+ require .Error (t , err )
160+
140161}
141162
142163func TestMatch (t * testing.T ) {
@@ -187,3 +208,21 @@ func TestValidCharacters(t *testing.T) {
187208 require .Error (t , err )
188209 }
189210}
211+
212+ func TestMustParse (t * testing.T ) {
213+ require .NotPanics (t , func () { fqbn .MustParse ("arduino:avr:uno" ) })
214+ require .Panics (t , func () { fqbn .MustParse ("ard=uino:avr=:u=no" ) })
215+ }
216+
217+ func TestClone (t * testing.T ) {
218+ a , err := fqbn .Parse ("arduino:avr:uno:opt1=1,opt2=2" )
219+ require .NoError (t , err )
220+ b := a .Clone ()
221+ require .True (t , b .Match (a ))
222+ require .True (t , a .Match (b ))
223+
224+ c , err := fqbn .Parse ("arduino:avr:uno:opt1=1,opt2=2,opt3=3" )
225+ require .NoError (t , err )
226+ require .True (t , c .Match (a ))
227+ require .False (t , a .Match (c ))
228+ }
0 commit comments