package plugin import "testing" func TestZoneMatches(t *testing.T) { child := "example.org." zones := Zones([]string{"org.", "."}) actual := zones.Matches(child) if actual != "org." { t.Errorf("Expected %v, got %v", "org.", actual) } child = "bla.example.org." zones = Zones([]string{"bla.example.org.", "org.", "."}) actual = zones.Matches(child) if actual != "bla.example.org." { t.Errorf("Expected %v, got %v", "org.", actual) } } func TestZoneNormalize(t *testing.T) { zones := Zones([]string{"example.org", "Example.ORG.", "example.org."}) expected := "example.org." zones.Normalize() for _, actual := range zones { if actual != expected { t.Errorf("Expected %v, got %v", expected, actual) } } } func TestNameMatches(t *testing.T) { matches := []struct { child string parent string expected bool }{ {".", ".", true}, {"example.org.", ".", true}, {"example.org.", "example.org.", true}, {"example.org.", "org.", true}, {"org.", "example.org.", false}, } for _, m := range matches { actual := Name(m.parent).Matches(m.child) if actual != m.expected { t.Errorf("Expected %v for %s/%s, got %v", m.expected, m.parent, m.child, actual) } } } func TestNameNormalize(t *testing.T) { names := []string{ "example.org", "example.org.", "Example.ORG.", "example.org."} for i := 0; i < len(names); i += 2 { ts := names[i] expected := names[i+1] actual := Name(ts).Normalize() if expected != actual { t.Errorf("Expected %v, got %v", expected, actual) } } } func TestHostNormalize(t *testing.T) { hosts := []string{".:53", ".", "example.org:53", "example.org.", "example.org.:53", "example.org.", "10.0.0.0/8:53", "10.in-addr.arpa.", "10.0.0.0/9", "10.in-addr.arpa.", "dns://example.org", "example.org."} for i := 0; i < len(hosts); i += 2 { ts := hosts[i] expected := hosts[i+1] actual := Host(ts).Normalize() if expected != actual { t.Errorf("Expected %v, got %v", expected, actual) } } } func TestHostMustNormalizeFail(t *testing.T) { hosts := []string{"..:53", "::", ""} for i := 0; i < len(hosts); i++ { ts := hosts[i] h, err := Host(ts).MustNormalize() if err == nil { t.Errorf("Expected error, got %v", h) } } } func TestSplitHostPortReverse(t *testing.T) { tests := map[string]int{ "example.org.": 0, "10.0.0.0/9": 32 - 9, "10.0.0.0/8": 32 - 8, "10.0.0.0/17": 32 - 17, "10.0.0.0/0": 32 - 0, "10.0.0.0/64": 0, "10.0.0.0": 0, "10.0.0": 0, "2003::1/65": 128 - 65, } for in, expect := range tests { _, _, n, err := SplitHostPort(in) if err != nil { t.Errorf("Expected no error, got %q for %s", in, err) } if n == nil { continue } ones, bits := n.Mask.Size() got := bits - ones if got != expect { t.Errorf("Expected %d, got %d for %s", expect, got, in) } } } /test/data/queue-without-filenames?id=c0ed70475ddf50ade51479d16fd3395d42231144&follow=1'>queue-without-filenames (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2023-06-03Give links in tags like <img> a "higher priority" to links in <a>Gravatar blankie 2-0/+37
2023-06-02Chore(deps): bump libc from 0.2.142 to 0.2.144Gravatar dependabot[bot] 1-2/+2
2023-06-02Chore(deps): bump curl-sys from 0.4.61+curl-8.0.1 to 0.4.63+curl-8.1.2Gravatar dependabot[bot] 2-3/+3
2023-05-26Chore(deps): bump cxx from 1.0.94 to 1.0.95Gravatar dependabot[bot] 1-8/+8
2023-05-26Chore(deps): bump cxx-build from 1.0.94 to 1.0.95Gravatar dependabot[bot] 1-4/+4
2023-05-18Chore(deps): bump bitflags from 2.2.1 to 2.3.1Gravatar dependabot[bot] 2-4/+4
2023-04-29Chore(deps): bump libc from 0.2.140 to 0.2.142Gravatar dependabot[bot] 1-2/+2
2023-04-29Chore(deps): bump bitflags from 2.0.2 to 2.2.1Gravatar dependabot[bot] 2-4/+4
2023-04-29Chore(deps): bump xdg from 2.4.1 to 2.5.0Gravatar dependabot[bot] 2-78/+93
2023-04-29Update expected-lite to 0.6.3Gravatar Alexander Batischev 1-14/+31
2023-04-29CI: fix FreeBSD 12.3 job by upgrading to 12.4Gravatar Alexander Batischev 1-4/+4
2023-04-25CI: bump Rust to 1.69.0Gravatar Alexander Batischev 4-10/+10
2023-04-05CI: bump Rust to 1.68.2Gravatar Alexander Batischev 4-10/+10
2023-04-01CI: use AStyle 3.1-r3 for code formattingGravatar Alexander Batischev 1-1/+1
2023-04-01Prepare for the next releaseGravatar Alexander Batischev 6-111/+156
2023-03-26Release 2.31r2.31Gravatar Alexander Batischev 6-22/+30
2023-03-26Bump copyright noticesGravatar Alexander Batischev 3-6/+6
2023-03-26CI: bump Rust to 1.68.1Gravatar Alexander Batischev 4-10/+10
2023-03-24Update Russian and Ukrainian translationsGravatar Alexander Batischev 2-10/+15
2023-03-23Chore(deps): bump cxx-build from 1.0.92 to 1.0.93Gravatar dependabot[bot] 1-3/+3
2023-03-21Chore(deps): bump curl-sys from 0.4.60+curl-7.88.1 to 0.4.61+curl-8.0.1Gravatar dependabot[bot] 2-3/+3
2023-03-20Chore(deps): bump bitflags from 2.0.1 to 2.0.2Gravatar dependabot[bot] 1-3/+3
2023-03-20Chore(deps): bump cxx from 1.0.92 to 1.0.93Gravatar dependabot[bot] 1-15/+26
2023-03-18Avoid calling virtual functions from destructorGravatar Alexander Batischev 1-3/+3
2023-03-18Do not shadow variablesGravatar Alexander Batischev 1-26/+26
2023-03-18Use std algorithm instead of a raw loopGravatar Alexander Batischev 1-6/+4
2023-03-18Mark overriden virtual functions with `override`Gravatar Alexander Batischev 1-6/+6
2023-03-18Avoid passing `std::string` by valueGravatar Alexander Batischev 3-7/+7
2023-03-18Mark single-argument constructors `explicit`Gravatar Alexander Batischev 3-3/+3
2023-03-18Reduce scope of some variables in testsGravatar Alexander Batischev 3-24/+19
2023-03-18Use proper Catch2 macros to test for true/falseGravatar Alexander Batischev 1-2/+2
2023-03-18tr.po: remove old translationGravatar Alexander Batischev 1-1/+1
2023-03-18Chore(deps): bump libc from 0.2.139 to 0.2.140Gravatar dependabot[bot] 1-2/+2
2023-03-17Update Italian translationGravatar Mauro Scomparin 1-5/+6
2023-03-16chore(l10n): Update Polish translationGravatar Carno 1-5/+5
2023-03-16Update Dutch translationGravatar Dennis van der Schagt 1-6/+8
2023-03-16Update Turkish translationsGravatar Emir SARI 1-6/+6
2023-03-16Chore(deps): bump bitflags from 1.3.2 to 2.0.1Gravatar dependabot[bot] 2-5/+11
2023-03-15Fix keybinds not working outside feedlist (#2358)Gravatar Alexander Batischev 17-16/+69
2023-03-15Update German translationsGravatar Lysander Trischler 1-52/+52
2023-03-15CI: bump Rust to 1.68.0Gravatar Alexander Batischev 4-10/+10
2023-03-15Update .pot and .po filesGravatar Alexander Batischev 19-3707/+3997
2023-03-13Chore(deps): bump chrono from 0.4.23 to 0.4.24Gravatar dependabot[bot] 1-2/+2