@@ -4406,6 +4406,79 @@ func TestColorInorderSendAll(t *testing.T) {
4406
4406
testWithFeatureFlag (t , tc , flags .ExperimentalAssetColors )
4407
4407
}
4408
4408
4409
+ func TestNoDoubleSpendingInColoredSendAll (t * testing.T ) {
4410
+
4411
+ script := `
4412
+ send [COIN *] (
4413
+ source = {
4414
+ @src \ "X"
4415
+ @src \ "X"
4416
+ @src
4417
+ }
4418
+ destination = @dest
4419
+ )
4420
+ `
4421
+
4422
+ tc := NewTestCase ()
4423
+ tc .setBalance ("src" , "COIN" , 100 )
4424
+ tc .setBalance ("src" , "COIN_X" , 20 )
4425
+ tc .compile (t , script )
4426
+
4427
+ tc .expected = CaseResult {
4428
+ Postings : []Posting {
4429
+ {
4430
+ Asset : "COIN_X" ,
4431
+ Amount : big .NewInt (20 ),
4432
+ Source : "src" ,
4433
+ Destination : "dest" ,
4434
+ },
4435
+ {
4436
+ Asset : "COIN" ,
4437
+ Amount : big .NewInt (100 ),
4438
+ Source : "src" ,
4439
+ Destination : "dest" ,
4440
+ },
4441
+ },
4442
+ }
4443
+ testWithFeatureFlag (t , tc , flags .ExperimentalAssetColors )
4444
+ }
4445
+
4446
+ func TestNoDoubleSpendingInColoredSend (t * testing.T ) {
4447
+ script := `
4448
+ send [COIN 100] (
4449
+ source = {
4450
+ @src \ "X"
4451
+ @src \ "X"
4452
+ @src
4453
+ }
4454
+ destination = @dest
4455
+ )
4456
+ `
4457
+
4458
+ tc := NewTestCase ()
4459
+ tc .setBalance ("src" , "COIN" , 99999 )
4460
+ tc .setBalance ("src" , "COIN_X" , 20 )
4461
+ tc .compile (t , script )
4462
+
4463
+ tc .expected = CaseResult {
4464
+ Postings : []Posting {
4465
+ {
4466
+ Asset : "COIN_X" ,
4467
+ Amount : big .NewInt (20 ),
4468
+ Source : "src" ,
4469
+ Destination : "dest" ,
4470
+ },
4471
+ {
4472
+ Asset : "COIN" ,
4473
+ Amount : big .NewInt (80 ),
4474
+ Source : "src" ,
4475
+ Destination : "dest" ,
4476
+ },
4477
+ },
4478
+ }
4479
+ testWithFeatureFlag (t , tc , flags .ExperimentalAssetColors )
4480
+ }
4481
+
4409
4482
func TestEmptyColor (t * testing.T ) {
4410
4483
// empty string color behaves as no color
4411
4484
0 commit comments