Skip to content

Commit

Permalink
not using ScalarLogical
Browse files Browse the repository at this point in the history
  • Loading branch information
romainfrancois committed Jan 16, 2014
1 parent 3df5fa7 commit fb43ab2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions inst/include/dplyr/BoolResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ namespace dplyr{
void set_false( const char* msg ){ result = false; message = msg ; }

inline operator SEXP() const {
Shield<SEXP> res( Rf_ScalarLogical( result ) ) ;
Rf_setAttrib( res, Rf_install("comment"), Rf_mkString(message.c_str()) );
Rf_setAttrib( res, Rf_install("class"), Rf_mkString("BoolResult") );
LogicalVector res = LogicalVector::create( result ) ;
res.attr("comment") = message ;
res.attr("class") = "BoolResult" ;
return res;
}

Expand Down
6 changes: 6 additions & 0 deletions inst/tests/test-equality.r
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,10 @@ test_that("integers and reals are not equal", {

expect_match(all.equal(df1, df2),
"Incompatible type for column x: x integer, y numeric")
})

test_that("BoolResult does not overwrite singleton R_TrueValue", {
dplyr:::equal_data_frame(mtcars, mtcars)
expect_equal( class(2 == 2), "logical" )

})

0 comments on commit fb43ab2

Please sign in to comment.