Add dnsmasq formatter tests
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
parent
f4c00d3d65
commit
6467320540
|
@ -59,3 +59,21 @@ pub fn format_to_dnsmasq(raw_hosts: String, ipv4_addr: &str, ipv6_addr: &str) ->
|
|||
}
|
||||
output
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
fn emit_hosts_file() -> String {
|
||||
std::fs::read_to_string("test_data/hosts").unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_dnsmasq_formatter() {
|
||||
let results = format_to_dnsmasq(emit_hosts_file(), "127.0.0.1", "::1");
|
||||
assert!(results.contains(&String::from("address=/adserver.abv.bg/127.0.0.1")));
|
||||
assert!(results.contains(&String::from("address=/adserver.abv.bg/::1")));
|
||||
assert!(!results.contains(&String::from("# Leading comment test 0.0.0.0 fr.a2dfp.net")));
|
||||
assert!(!results.contains(&String::from("# Normal comment")));
|
||||
assert!(!results.contains(&String::from("address=/localhost/127.0.01")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
|
||||
127.0.0.1 localhost
|
||||
127.0.0.1 localhost.localdomain
|
||||
127.0.0.1 local
|
||||
255.255.255.255 broadcasthost
|
||||
::1 localhost
|
||||
::1 ip6-localhost
|
||||
::1 ip6-loopback
|
||||
fe80::1%lo0 localhost
|
||||
ff00::0 ip6-localnet
|
||||
ff00::0 ip6-mcastprefix
|
||||
ff02::1 ip6-allnodes
|
||||
ff02::2 ip6-allrouters
|
||||
ff02::3 ip6-allhosts
|
||||
0.0.0.0 0.0.0.0
|
||||
127.0.1.1 ryzenbox
|
||||
127.0.0.53 ryzenbox # Trailing comment test
|
||||
# Leading comment test 0.0.0.0 fr.a2dfp.net
|
||||
0.0.0.0 m.fr.a2dfp.net
|
||||
0.0.0.0 mfr.a2dfp.net
|
||||
0.0.0.0 ad.a8.net
|
||||
0.0.0.0 asy.a8ww.net
|
||||
0.0.0.0 static.a-ads.com
|
||||
0.0.0.0 abcstats.com
|
||||
0.0.0.0 a.abv.bg
|
||||
0.0.0.0 adserver.abv.bg
|
||||
0.0.0.0 adv.abv.bg
|
||||
0.0.0.0 bimg.abv.bg
|
||||
0.0.0.0 ca.abv.bg
|
||||
# Normal comment
|
||||
0.0.0.0 track.acclaimnetwork.com
|
||||
0.0.0.0 csh.actiondesk.com
|
||||
0.0.0.0 ads.activepower.net
|
||||
0.0.0.0 ad.activesolutions.cz
|
||||
0.0.0.0 app.activetrail.com
|
||||
0.0.0.0 traffic.acwebconnecting.com
|
||||
0.0.0.0 office.ad1.ru
|
||||
0.0.0.0 cms.ad2click.nl
|
||||
0.0.0.0 ad2games.com
|
||||
0.0.0.0 content.ad20.net
|
||||
0.0.0.0 core.ad20.net
|
||||
0.0.0.0 banner.ad.nu
|
||||
0.0.0.0 adadvisor.net
|
||||
0.0.0.0 wad.adbasket.net
|
||||
0.0.0.0 adbox.hu
|
||||
0.0.0.0 b.adbox.lv
|
||||
0.0.0.0 adboost.ro
|
||||
0.0.0.0 www.adchimp.com
|
||||
0.0.0.0 static.adclick.lt
|
||||
0.0.0.0 engine.adclick.lv
|
||||
0.0.0.0 show.adclick.lv
|
||||
0.0.0.0 static.adclick.lv
|
||||
0.0.0.0 www.adclick.lv
|
||||
0.0.0.0 adclicks.io
|
||||
0.0.0.0 servedby.adcombination.com
|
||||
0.0.0.0 adcomplete.com
|
||||
0.0.0.0 www.adcomplete.com
|
||||
0.0.0.0 adcore.ru
|
||||
0.0.0.0 pixel.adcrowd.com
|
||||
0.0.0.0 ct1.addthis.com
|
||||
0.0.0.0 static.uk.addynamo.com
|
||||
0.0.0.0 adexc.net
|
||||
0.0.0.0 s.adexpert.cz
|
||||
0.0.0.0 static.adfclick1.com
|
||||
0.0.0.0 c.adfirmative.com
|
||||
0.0.0.0 www.adfirmative.com
|
||||
0.0.0.0 adfocus.ru
|
||||
0.0.0.0 adform.net
|
||||
0.0.0.0 a1.adform.net
|
||||
0.0.0.0 adx.adform.net
|
||||
0.0.0.0 dmp.adform.net
|
||||
0.0.0.0 s1.adform.net
|
||||
0.0.0.0 server.adform.net
|
||||
0.0.0.0 track.adform.net
|
||||
0.0.0.0 server.adformdsp.net
|
||||
0.0.0.0 adforce.ru
|
||||
0.0.0.0 ads.adfox.ru
|
||||
0.0.0.0 gazeta.adfox.ru
|
||||
0.0.0.0 s.adframesrc.com
|
||||
0.0.0.0 media.adfrontiers.com
|
||||
0.0.0.0 www.adgitize.com
|
Loading…
Reference in New Issue