summaryrefslogtreecommitdiffstats
path: root/helpers/path_test.go
AgeCommit message (Collapse)Author
2015-05-16Add support for URLs relative to context rootbep
Setting `RelativeURLs` to `true` will make all relative URLs in the site *really* relative. And will do so with speed. So: In `/post/myblogpost.html`: `/mycss.css` becomes `../mycss.css` The same in `/index.html` will become: `./mycss.css` etc. Note that absolute URLs will not be touched (either external resources, or URLs constructed with `BaseURL`). The speediness is about the same as before: ``` benchmark old ns/op new ns/op delta BenchmarkAbsURL 17462 18164 +4.02% BenchmarkAbsURLSrcset 18842 19632 +4.19% BenchmarkXMLAbsURLSrcset 18643 19313 +3.59% BenchmarkXMLAbsURL 9283 9656 +4.02% benchmark old allocs new allocs delta BenchmarkAbsURL 24 28 +16.67% BenchmarkAbsURLSrcset 29 32 +10.34% BenchmarkXMLAbsURLSrcset 27 30 +11.11% BenchmarkXMLAbsURL 12 14 +16.67% benchmark old bytes new bytes delta BenchmarkAbsURL 3154 3404 +7.93% BenchmarkAbsURLSrcset 2376 2573 +8.29% BenchmarkXMLAbsURLSrcset 2569 2763 +7.55% BenchmarkXMLAbsURL 1888 1998 +5.83% ``` Fixes #1104 Fixes #622 Fixes #937 Fixes #157
2015-04-03helpers: fix some go vet errorsbep
2015-04-02List directories being watched when server is runDylan MacKenzie
Fixes part of issue 1030. Previously hugo only listed the content directory as being watched. Now we list all files being watched according to `commands.getDirList()`. We also introduce a RemoveSubpaths function and test in the helpers module to reduce noise in the command line output by not showing subdirectories of ones already being watched. For example, instead of: `Watching for changes in $HOME/blog/content` We get: `Watching for changes in $HOME/blog/{data,content,layouts,static,themes/my-theme}`
2015-03-06Fix errors reported by Go Vetbep
2015-02-17Merge to stay up to date with current devCyrill Schumacher
Feature: GetJson and GetJson in short codes or other layout files. For more details please see: http://cyrillschumacher.com/2014/12/21/dynamic-pages-with-gohugo.io/
2015-01-27Use runtime.GOOS to identify Windows specific path testsbep
2015-01-27Split Windows and Unix specific path testsbep
2015-01-27Temporarily comment out breaking Windows test casebep
2015-01-27Introduce FilepathPathBridgebep
This commit introduces the new interface FilepathPathBridge to remove some code that differs only in their use of either the path or filepath package.
2015-01-27Add more tests to helperbep
2014-12-09Fix various Windows-issuesbep
File handling was broken on Windows. This commit contains a revision of the path handling with separation of file paths and urls where needed. There may be remaining issues and there may be better ways to do this, but it is easier to start that refactoring job with a set of passing tests. Fixes #687 Fixes #660
2014-11-13Reinsert deleted testbep
This test was deleted by mistake in owenwaller's contribution to add more tests. I haven't looked closer, there may be more missing.
2014-11-04Fixing some testsspf13
2014-11-04Updating tests to use hugofsspf13
2014-11-04rewriting guessSection to accurately reflect intent and usage. Update tests.spf13
2014-11-04First stab at correcting GuessSection testsOwen Waller
Updated the test to correctly test for "" when a non-absolute path is used. But the tests still fail for multi-part paths e.g. /contents/blog/
2014-11-04Fix: remove the unnecessary dot in an extensionOwen Waller
Oops minor typo. The new extension passed to ReplaceExtension should not have a dot in it. The test data bas been updated to reflect this.
2014-11-04Updated TestReplaceExtensioni, TestFilename and TestFileAndExtOwen Waller
Updated the test cases in TestReplaceExtension to reflect the intent of ReplaceExtension which is to accept a path and return only the file name with a new extension. It's intentionally designed to strip out the path and only provide the filename Additional test cases have been added to both TestFilename and TestFileAndExt to clarify behaviour with relative paths.
2014-11-04WriteToDisk and SafeWriteToDisk test cleaned upOwen Waller
Minor cleanup to randomise the names of the temp directories used by the tests.
2014-11-04WriteToDisk and SafeWriteToDisk tests now passOwen Waller
This is the first time that both the WriteToDisk and SafeWriteToDisk tests pass
2014-11-04Fix: Test TestSafeWriteToDisk now worksOwen Waller
Oops, my bad. Despite the function intending to test SafeWriteToDisk it was actually calling WriteToDisk. WriteToDisk does not return the file exists error that SafeWriteToDisk does, which the test checks for.
2014-11-04Added the path modules test filesOwen Waller
Added the new path modules test file. This replaces the old helpers_test.go file. The currently failing tests are: TestReplaceExtension TestFilename TestFileAndExt TestGuessSection TestFindCWD TestWriteToDisk In addition the TestSafeWriteToDisk test case is currently disabled. It will panic if enabled. In addition there are some minor changes to path.go. They are: Refactored MakePathToLower to simplify it. Commented out, pending removal, Sanitize as it appears to be unused. Fixed the resource leak in UnicodeSanitize Conflicts: helpers/path.go