File: options_nocomma_test.go

package info (click to toggle)
golang-github-jacobsa-bazilfuse 0.0~git20150622-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 736 kB
  • sloc: sh: 26; makefile: 4
file content (33 lines) | stat: -rw-r--r-- 857 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
24
25
26
27
28
29
30
31
32
33
// This file contains tests for platforms that have no escape
// mechanism for including commas in mount options.
//
// +build darwin

package bazilfuse_test

import (
	"runtime"
	"testing"

	"github.com/jacobsa/bazilfuse/fs/fstestutil"
)

func TestMountOptionCommaError(t *testing.T) {
	t.Parallel()
	// this test is not tied to any specific option, it just needs
	// some string content
	var evil = "FuseTest,Marker"
	mnt, err := fstestutil.MountedT(t, fstestutil.SimpleFS{fstestutil.Dir{}},
		func(conf *fuse.mountConfig) error {
			fuse.ForTestSetMountOption(conf, "fusetest", evil)
			return nil
		},
	)
	if err == nil {
		mnt.Close()
		t.Fatal("expected an error about commas")
	}
	if g, e := err.Error(), `mount options cannot contain commas on `+runtime.GOOS+`: "fusetest"="FuseTest,Marker"`; g != e {
		t.Fatalf("wrong error: %q != %q", g, e)
	}
}