@@ -565,3 +565,62 @@ test "URL: concatQueryString" {
565565 try testing .expectEqual ("https://www.lightpanda.io/index?1=2&a=b" , url );
566566 }
567567}
568+
569+ test "URL: eqlDocument" {
570+ defer testing .reset ();
571+ const arena = testing .arena_allocator ;
572+
573+ {
574+ const url1 = try URL .parse ("https://lightpanda.io/about" , null );
575+ const url2 = try URL .parse ("https://lightpanda.io/about" , null );
576+ try testing .expectEqual (true , try url1 .eqlDocument (& url2 , arena ));
577+ }
578+
579+ {
580+ const url1 = try URL .parse ("https://lightpanda.io/about" , null );
581+ const url2 = try URL .parse ("http://lightpanda.io/about" , null );
582+ try testing .expectEqual (false , try url1 .eqlDocument (& url2 , arena ));
583+ }
584+
585+ {
586+ const url1 = try URL .parse ("https://lightpanda.io/about" , null );
587+ const url2 = try URL .parse ("https://example.com/about" , null );
588+ try testing .expectEqual (false , try url1 .eqlDocument (& url2 , arena ));
589+ }
590+
591+ {
592+ const url1 = try URL .parse ("https://lightpanda.io:8080/about" , null );
593+ const url2 = try URL .parse ("https://lightpanda.io:9090/about" , null );
594+ try testing .expectEqual (false , try url1 .eqlDocument (& url2 , arena ));
595+ }
596+
597+ {
598+ const url1 = try URL .parse ("https://lightpanda.io/about" , null );
599+ const url2 = try URL .parse ("https://lightpanda.io/contact" , null );
600+ try testing .expectEqual (false , try url1 .eqlDocument (& url2 , arena ));
601+ }
602+
603+ {
604+ const url1 = try URL .parse ("https://lightpanda.io/about?foo=bar" , null );
605+ const url2 = try URL .parse ("https://lightpanda.io/about?baz=qux" , null );
606+ try testing .expectEqual (true , try url1 .eqlDocument (& url2 , arena ));
607+ }
608+
609+ {
610+ const url1 = try URL .parse ("https://lightpanda.io/about#section1" , null );
611+ const url2 = try URL .parse ("https://lightpanda.io/about#section2" , null );
612+ try testing .expectEqual (true , try url1 .eqlDocument (& url2 , arena ));
613+ }
614+
615+ {
616+ const url1 = try URL .parse ("https://lightpanda.io/about" , null );
617+ const url2 = try URL .parse ("https://lightpanda.io/about/" , null );
618+ try testing .expectEqual (false , try url1 .eqlDocument (& url2 , arena ));
619+ }
620+
621+ {
622+ const url1 = try URL .parse ("https://lightpanda.io/" , null );
623+ const url2 = try URL .parse ("https://lightpanda.io" , null );
624+ try testing .expectEqual (false , try url1 .eqlDocument (& url2 , arena ));
625+ }
626+ }
0 commit comments