Skip to content

Commit

Permalink
Update a few tests to work with windows paths system
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosnav committed Jan 28, 2025
1 parent eb00b69 commit f3788ae
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/interpreters/r_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ func (s *RSuite) TestRenvEnvironmentErrorCheck_renvNotInstalled() {

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

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

i, _ := NewRInterpreter(s.cwd, util.Path{}, log, executor, nil, nil)
interpreter := i.(*defaultRInterpreter)
Expand All @@ -647,8 +647,8 @@ func (s *RSuite) TestRenvEnvironmentErrorCheck_renvRequiresInit() {
renvStatusOutput := []byte("Use `renv::init()` to initialize the project.")
executor := executortest.NewMockExecutor()
executor.On("RunCommand", mock.Anything, []string{"--version"}, mock.Anything, mock.Anything).Return([]byte("R version 4.3.0 (2023-04-21)"), nil, nil)
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)
executor.On("RunCommand", "/usr/bin/R", []string{"-s", "-e", "renv::status()"}, mock.Anything, mock.Anything).Return(renvStatusOutput, nil, nil)
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)
executor.On("RunCommand", mock.Anything, []string{"-s", "-e", "renv::status()"}, mock.Anything, mock.Anything).Return(renvStatusOutput, nil, nil)

i, _ := NewRInterpreter(s.cwd, util.Path{}, log, executor, nil, nil)
interpreter := i.(*defaultRInterpreter)
Expand All @@ -673,8 +673,8 @@ func (s *RSuite) TestRenvEnvironmentErrorCheck_lockfileMissing() {
renvStatusOutput := []byte("Use `renv::snapshot()` to create a lockfile.")
executor := executortest.NewMockExecutor()
executor.On("RunCommand", mock.Anything, []string{"--version"}, mock.Anything, mock.Anything).Return([]byte("R version 4.3.0 (2023-04-21)"), nil, nil)
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)
executor.On("RunCommand", "/usr/bin/R", []string{"-s", "-e", "renv::status()"}, mock.Anything, mock.Anything).Return(renvStatusOutput, nil, nil)
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)
executor.On("RunCommand", mock.Anything, []string{"-s", "-e", "renv::status()"}, mock.Anything, mock.Anything).Return(renvStatusOutput, nil, nil)

i, _ := NewRInterpreter(s.cwd, util.Path{}, log, executor, nil, nil)
interpreter := i.(*defaultRInterpreter)
Expand All @@ -699,8 +699,8 @@ func (s *RSuite) TestRenvEnvironmentErrorCheck_unknownRenvStatus() {
renvStatusOutput := []byte("- The project is out-of-sync -- use `renv::status()` for details.")
executor := executortest.NewMockExecutor()
executor.On("RunCommand", mock.Anything, []string{"--version"}, mock.Anything, mock.Anything).Return([]byte("R version 4.3.0 (2023-04-21)"), nil, nil)
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)
executor.On("RunCommand", "/usr/bin/R", []string{"-s", "-e", "renv::status()"}, mock.Anything, mock.Anything).Return(renvStatusOutput, nil, nil)
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)
executor.On("RunCommand", mock.Anything, []string{"-s", "-e", "renv::status()"}, mock.Anything, mock.Anything).Return(renvStatusOutput, nil, nil)

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

0 comments on commit f3788ae

Please sign in to comment.