Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions inst/robotstxts/robots_commented_token.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
User-agent: bot_1
Disallow: /path_1

# User-agent: bot_2
# Disallow: /path_2

# Sitemap: /sitemap.php
14 changes: 14 additions & 0 deletions tests/testthat/test_parser.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ rtxt_fb_nsp <- rt_get_rtxt("robots_facebook_unsupported.txt")
rtxt_cdc <- rt_get_rtxt("robots_cdc.txt")
rtxt_cdc2 <- paste(rt_get_rtxt("robots_cdc2.txt"), collapse = "\r\n")
rtxt_rbloggers <- rt_get_rtxt("rbloggers.txt")
rtxt_ct <- rt_get_rtxt("robots_commented_token.txt")

test_that(
"all robots.txt files are valid", {
Expand Down Expand Up @@ -118,6 +119,10 @@ test_that(
expect_true(
is_valid_robotstxt( rtxt_cdc )
)

expect_true(
is_valid_robotstxt( rtxt_ct )
)
})


Expand Down Expand Up @@ -213,6 +218,15 @@ test_that(
}
)

context("Commented-out tokens get parsed correctly")

test_that(
"Commented-out tokens get ignored", {
expect_true(
nrow(parse_robotstxt(rtxt_ct)$permissions) == 1
)
}
)



Expand Down