Closed
Conversation
Collaborator
|
Will this work? console.log("foo%%bar", "blah"); // Should print "foo%bar blah"Also, any thoughts on console.warn and console.error? |
Perryvw
reviewed
Feb 22, 2019
test/unit/console.spec.ts
Outdated
| @TestCase('console.assert(false, "message")', 'assert(false, "message");') | ||
| @TestCase('console.assert(false, "message %s", "info")', 'assert(false, string.format("message %s", "info"));') | ||
| @TestCase('console.assert(false, "message", "more")', 'assert(false, "message", "more");') | ||
| @Test("Console") |
Member
There was a problem hiding this comment.
You can split these up into different test cases: one for log, one for trace, one for assert, and put the input parameters in the TestCase (i.e. @TestCase(""), @TestCase("Hello %"))
src/LuaTransformer.ts
Outdated
| switch (methodName) { | ||
| case "log": | ||
| if (expression.arguments.length > 0) { | ||
| if (ts.isStringLiteral(expression.arguments[0]) |
Member
There was a problem hiding this comment.
It's probably a good idea to refactor this to a private helper method under this function:
private isStringFormatTemplate(expression: ts.Expression): boolean {
return ts.isStringLiteral(expression) && expression.text.includes("%");
}* update README. add logo * update readme * update readme * update readme * update badges * update badges * update badges * fix links on badges on readme * fix link to travis
* tupleReturn improvements - fixed `@tupleReturn` on arrow functions - enabled inference of tupleReturn on arrow functions - preventing wrap+unpack when using spread operator on tupleReturn function * added tests for argument inference * better name
…e, not the generator function. (TypeScriptToLua#448)
Contributor
Author
|
Welp, this has gone bad. I'm gunna try again |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #439
Added some functions from
consolethat translate to Lua.log,assertandtrace.