Skip to content

Commit f3788ae

Browse files
committed
Update a few tests to work with windows paths system
1 parent eb00b69 commit f3788ae

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

internal/interpreters/r_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ func (s *RSuite) TestRenvEnvironmentErrorCheck_renvNotInstalled() {
601601

602602
executor := executortest.NewMockExecutor()
603603
executor.On("RunCommand", mock.Anything, []string{"--version"}, mock.Anything, mock.Anything).Return([]byte("R version 4.3.0 (2023-04-21)"), nil, nil)
604-
executor.On("RunCommand", "/usr/bin/R", []string{"-s", "-e", "cat(system.file(package = \"renv\"))"}, mock.Anything, mock.Anything).Return([]byte(""), nil, nil)
604+
executor.On("RunCommand", mock.Anything, []string{"-s", "-e", "cat(system.file(package = \"renv\"))"}, mock.Anything, mock.Anything).Return([]byte(""), nil, nil)
605605

606606
i, _ := NewRInterpreter(s.cwd, util.Path{}, log, executor, nil, nil)
607607
interpreter := i.(*defaultRInterpreter)
@@ -626,7 +626,7 @@ func (s *RSuite) TestRenvEnvironmentErrorCheck_renvInstallCheckErr() {
626626
renvCmdErr := errors.New("renv command errrz")
627627
executor := executortest.NewMockExecutor()
628628
executor.On("RunCommand", mock.Anything, []string{"--version"}, mock.Anything, mock.Anything).Return([]byte("R version 4.3.0 (2023-04-21)"), nil, nil)
629-
executor.On("RunCommand", "/usr/bin/R", []string{"-s", "-e", "cat(system.file(package = \"renv\"))"}, mock.Anything, mock.Anything).Return([]byte(""), nil, renvCmdErr)
629+
executor.On("RunCommand", mock.Anything, []string{"-s", "-e", "cat(system.file(package = \"renv\"))"}, mock.Anything, mock.Anything).Return([]byte(""), nil, renvCmdErr)
630630

631631
i, _ := NewRInterpreter(s.cwd, util.Path{}, log, executor, nil, nil)
632632
interpreter := i.(*defaultRInterpreter)
@@ -647,8 +647,8 @@ func (s *RSuite) TestRenvEnvironmentErrorCheck_renvRequiresInit() {
647647
renvStatusOutput := []byte("Use `renv::init()` to initialize the project.")
648648
executor := executortest.NewMockExecutor()
649649
executor.On("RunCommand", mock.Anything, []string{"--version"}, mock.Anything, mock.Anything).Return([]byte("R version 4.3.0 (2023-04-21)"), nil, nil)
650-
executor.On("RunCommand", "/usr/bin/R", []string{"-s", "-e", "cat(system.file(package = \"renv\"))"}, mock.Anything, mock.Anything).Return([]byte("/usr/dir/lib/R/x86_64/4.4/library/renv"), nil, nil)
651-
executor.On("RunCommand", "/usr/bin/R", []string{"-s", "-e", "renv::status()"}, mock.Anything, mock.Anything).Return(renvStatusOutput, nil, nil)
650+
executor.On("RunCommand", mock.Anything, []string{"-s", "-e", "cat(system.file(package = \"renv\"))"}, mock.Anything, mock.Anything).Return([]byte("/usr/dir/lib/R/x86_64/4.4/library/renv"), nil, nil)
651+
executor.On("RunCommand", mock.Anything, []string{"-s", "-e", "renv::status()"}, mock.Anything, mock.Anything).Return(renvStatusOutput, nil, nil)
652652

653653
i, _ := NewRInterpreter(s.cwd, util.Path{}, log, executor, nil, nil)
654654
interpreter := i.(*defaultRInterpreter)
@@ -673,8 +673,8 @@ func (s *RSuite) TestRenvEnvironmentErrorCheck_lockfileMissing() {
673673
renvStatusOutput := []byte("Use `renv::snapshot()` to create a lockfile.")
674674
executor := executortest.NewMockExecutor()
675675
executor.On("RunCommand", mock.Anything, []string{"--version"}, mock.Anything, mock.Anything).Return([]byte("R version 4.3.0 (2023-04-21)"), nil, nil)
676-
executor.On("RunCommand", "/usr/bin/R", []string{"-s", "-e", "cat(system.file(package = \"renv\"))"}, mock.Anything, mock.Anything).Return([]byte("/usr/dir/lib/R/x86_64/4.4/library/renv"), nil, nil)
677-
executor.On("RunCommand", "/usr/bin/R", []string{"-s", "-e", "renv::status()"}, mock.Anything, mock.Anything).Return(renvStatusOutput, nil, nil)
676+
executor.On("RunCommand", mock.Anything, []string{"-s", "-e", "cat(system.file(package = \"renv\"))"}, mock.Anything, mock.Anything).Return([]byte("/usr/dir/lib/R/x86_64/4.4/library/renv"), nil, nil)
677+
executor.On("RunCommand", mock.Anything, []string{"-s", "-e", "renv::status()"}, mock.Anything, mock.Anything).Return(renvStatusOutput, nil, nil)
678678

679679
i, _ := NewRInterpreter(s.cwd, util.Path{}, log, executor, nil, nil)
680680
interpreter := i.(*defaultRInterpreter)
@@ -699,8 +699,8 @@ func (s *RSuite) TestRenvEnvironmentErrorCheck_unknownRenvStatus() {
699699
renvStatusOutput := []byte("- The project is out-of-sync -- use `renv::status()` for details.")
700700
executor := executortest.NewMockExecutor()
701701
executor.On("RunCommand", mock.Anything, []string{"--version"}, mock.Anything, mock.Anything).Return([]byte("R version 4.3.0 (2023-04-21)"), nil, nil)
702-
executor.On("RunCommand", "/usr/bin/R", []string{"-s", "-e", "cat(system.file(package = \"renv\"))"}, mock.Anything, mock.Anything).Return([]byte("/usr/dir/lib/R/x86_64/4.4/library/renv"), nil, nil)
703-
executor.On("RunCommand", "/usr/bin/R", []string{"-s", "-e", "renv::status()"}, mock.Anything, mock.Anything).Return(renvStatusOutput, nil, nil)
702+
executor.On("RunCommand", mock.Anything, []string{"-s", "-e", "cat(system.file(package = \"renv\"))"}, mock.Anything, mock.Anything).Return([]byte("/usr/dir/lib/R/x86_64/4.4/library/renv"), nil, nil)
703+
executor.On("RunCommand", mock.Anything, []string{"-s", "-e", "renv::status()"}, mock.Anything, mock.Anything).Return(renvStatusOutput, nil, nil)
704704

705705
i, _ := NewRInterpreter(s.cwd, util.Path{}, log, executor, nil, nil)
706706
interpreter := i.(*defaultRInterpreter)

0 commit comments

Comments
 (0)