Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use is.character over inherits(character) #693

Merged
merged 3 commits into from Nov 12, 2020

Conversation

MichaelChirico
Copy link
Contributor

Ran into this issue:

file.create(tmp <- tempfile())
l = xfun::file_string(tmp)
is.character(l)
# [1] TRUE
inherits(l, 'character')
# [2] FALSE
styler::style_text(l)
# Error in construct_vertical(styled_text) : 
#   inherits(x, what = c("utf8", "character", "vertical")) is not TRUE

After this PR:

styler::style_text(l)

Warning message:
Text to style did not contain any tokens. Returning empty string. 

I also filed this with xfun: yihui/xfun#41 but I do think is.character is probably preferable anyway.

LMK if there's any test to add

@lorenzwalthert
Copy link
Collaborator

Hi @MichaelChirico. Thanks for reporting.

R/vertical.R Outdated Show resolved Hide resolved
@codecov-io
Copy link

Codecov Report

Merging #693 (f738c2a) into master (4fdbfd1) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #693   +/-   ##
=======================================
  Coverage   90.41%   90.41%           
=======================================
  Files          47       47           
  Lines        2223     2223           
=======================================
  Hits         2010     2010           
  Misses        213      213           
Impacted Files Coverage Δ
R/io.R 87.75% <100.00%> (ø)
R/vertical.R 60.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4fdbfd1...f738c2a. Read the comment docs.

@lorenzwalthert lorenzwalthert merged commit 491f3c3 into r-lib:master Nov 12, 2020
2 checks passed
@lorenzwalthert
Copy link
Collaborator

Thanks @MichaelChirico.

@MichaelChirico MichaelChirico deleted the is-character branch November 18, 2020 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants