diff --git a/CHANGELOG.md b/CHANGELOG.md index a2f2a9d..5198dd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - Add `fromInteger()` and `tryFromInteger()` on the new `Contracts\Factory4Interface` (IPv4 and Multi). - Arbitrary-precision `fromIntegerString()` and `tryFromIntegerString()` on all classes. - Fix: `Multi::fromProtocol()` now rejects a binary string of the wrong length instead of passing it through. +- Fix: `Multi::fromEmbedded()` now keeps the strategy it is given instead of falling back to the default. ### Output diff --git a/docs/04-helpers.md b/docs/04-helpers.md index 798154b..3a7f34e 100644 --- a/docs/04-helpers.md +++ b/docs/04-helpers.md @@ -228,6 +228,7 @@ an IPv6 address. ```php assertSame('2002:0c22:384e:0000:0000:0000:0000:0000', $ip->toExpandedAddress()); } + /** @test */ + #[PHPUnit\Test] + public function testFromEmbeddedUsesExplicitStrategy(): void + { + $ip = IP::fromEmbedded('127.0.0.1', new Strategy\Derived()); + $this->assertSame('2002:7f00:1::', $ip->toCompactedAddress()); + $this->assertSame('127.0.0.1', $ip->toDotAddress()); + } + /** * @test * @dataProvider \Darsyn\IP\Tests\DataProvider\Multi::getValidBinarySequences()