fileutils_test.go 613 B

12345678910111213141516171819202122232425262728293031
  1. package megauploader
  2. import "testing"
  3. func TestNoExtZero(t *testing.T) {
  4. if newFileIncrement("foo").Increment(0) != "foo" {
  5. t.Fail()
  6. }
  7. }
  8. func TestNoExtMore(t *testing.T) {
  9. if newFileIncrement("foo").Increment(1) != "foo-1" {
  10. t.Fail()
  11. }
  12. if newFileIncrement("foo").Increment(2) != "foo-2" {
  13. t.Fail()
  14. }
  15. }
  16. func TestExtZero(t *testing.T) {
  17. if newFileIncrement("foo.ogg").Increment(0) != "foo.ogg" {
  18. t.Fail()
  19. }
  20. }
  21. func TestExtMore(t *testing.T) {
  22. if newFileIncrement("foo.ogg").Increment(1) != "foo-1.ogg" {
  23. t.Fail()
  24. }
  25. if newFileIncrement("foo.ogg").Increment(2) != "foo-2.ogg" {
  26. t.Fail()
  27. }
  28. }