Merge remote-tracking branch 'origin/master'

This commit is contained in:
Yann Cébron
2016-04-26 20:49:28 +02:00
3 changed files with 7 additions and 10 deletions
@@ -41,7 +41,7 @@ class NamingConventionMacrosTest extends TestCase {
assert "a_b_c_d_e_f_g" == snakeCase("a-b.c/d|e*f+g")
assert "a_b" == snakeCase("a--b")
assert "foo_bar" == snakeCase("FOO BAR")
assert "" == snakeCase("0")
assert "" == snakeCase("")
}
public void "test lowercase and dash"() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,16 +43,13 @@ public class ConvertToCamelCaseMacro extends MacroBase {
@Override
protected Result calculateResult(@NotNull Expression[] params, ExpressionContext context, boolean quick) {
final String text = getTextResult(params, context, true);
if (text != null) {
return convertString(text);
}
return null;
return text != null ? convertString(text) : null;
}
@SuppressWarnings("StringToUpperCaseOrToLowerCaseWithoutLocale")
@Nullable
@NotNull
@VisibleForTesting
public Result convertString(String text) {
public Result convertString(@NotNull String text) {
final String[] strings = splitWords(text);
if (strings.length > 0) {
final StringBuilder buf = new StringBuilder();
@@ -65,7 +62,7 @@ public class ConvertToCamelCaseMacro extends MacroBase {
}
return new TextResult(buf.toString());
}
return null;
return new TextResult("");
}
@NotNull
@@ -72,7 +72,7 @@
</context>
</template>
<template description="" name="!" toReformat="true" toShortenFQNames="true"
value="&lt;!doctype html&gt;&#10;&lt;html lang=&quot;$ENV_LOCALE$&quot;&gt;&#10;&lt;head&gt;&#10;&lt;meta charset=&quot;UTF-8&quot;&gt;&#10;
value="&lt;!doctype html&gt;&#10;&lt;html lang=&quot;$ENV_LOCALE$&quot;&gt;&#10;&lt;head&gt;&#10;&lt;meta charset=&quot;$CHARSET$&quot;&gt;&#10;
&lt;meta name=&quot;viewport&quot; content=&quot;width=$WIDTH$, user-scalable=$SCALABLE$, initial-scale=$INITIAL_SCALE$, maximum-scale=$MAX_SCALE$, minimum-scale=$MIN_SCALE$&quot;&gt;&#10;
&lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;ie=$IE$&quot;&gt;&#10;
&lt;title&gt;$TITLE$&lt;/title&gt;&#10;&lt;/head&gt;&#10;&lt;body&gt;&#10; $END$&#10;&lt;/body&gt;&#10;&lt;/html&gt;">