up3
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package block_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/df-mc/dragonfly/server/block"
|
||||
"github.com/df-mc/dragonfly/server/block/cube"
|
||||
"github.com/df-mc/dragonfly/server/entity"
|
||||
"github.com/df-mc/dragonfly/server/world"
|
||||
)
|
||||
|
||||
// TestTorchBreaksWithoutSupport verifies that a torch is broken by a neighbour
|
||||
// update on the tick after its supporting block is removed, using a
|
||||
// synchronous World to make the tick deterministic.
|
||||
func TestTorchBreaksWithoutSupport(t *testing.T) {
|
||||
w := world.Config{Synchronous: true, Entities: entity.DefaultRegistry}.New()
|
||||
defer w.Close()
|
||||
|
||||
support, torch := cube.Pos{0, 0, 0}, cube.Pos{0, 1, 0}
|
||||
<-w.Exec(func(tx *world.Tx) {
|
||||
tx.SetBlock(support, block.Stone{}, nil)
|
||||
tx.SetBlock(torch, block.Torch{Facing: cube.FaceDown}, nil)
|
||||
tx.SetBlock(support, block.Air{}, nil)
|
||||
})
|
||||
w.AdvanceTick()
|
||||
|
||||
<-w.Exec(func(tx *world.Tx) {
|
||||
if b := tx.Block(torch); b != (block.Air{}) {
|
||||
t.Errorf("expected torch to break after removing its support, got %v", b)
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user