File: test-url.R

package info (click to toggle)
r-cran-webshot 0.5.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 600 kB
  • sloc: javascript: 5,565; makefile: 5
file content (23 lines) | stat: -rw-r--r-- 930 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
test_that("fix_windows_url works properly", {
  testthat::skip_if_not(is_windows())

  # Should add file:/// to file paths
  expect_equal(
    suppressWarnings(fix_windows_url("c:/path/file.html")),
    "file:///c:/path/file.html"
  )
  expect_equal(
    suppressWarnings(fix_windows_url("c:\\path\\file.html")),
    "file:///c:/path/file.html"
  )

  # Currently disabled because I'm not sure exactly should happen when there's
  # not a leading drive letter like "c:"
  # expect_equal(fix_windows_url("/path/file.html"), "file:///c:/path/file.html")
  # expect_equal(fix_windows_url("\\path\\file.html"), "file:///c:/path/file.html")
  # expect_equal(fix_windows_url("/path\\file.html"), "file:///c:/path/file.html")

  # Shouldn't affect proper URLs
  expect_equal(fix_windows_url("file:///c:/path/file.html"), "file:///c:/path/file.html")
  expect_equal(fix_windows_url("http://x.org/file.html"), "http://x.org/file.html")
})