Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
硅谷海盗
kotlin
提交
7ba22df3
K
kotlin
项目概览
硅谷海盗
/
kotlin
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kotlin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7ba22df3
编写于
5月 02, 2012
作者:
P
pTalanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract JetCompilerMessagingTest from IDECompilerMessagingTest.
上级
7e58e4d9
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
73 addition
and
35 deletion
+73
-35
idea/tests/org/jetbrains/jet/plugin/compilerMessages/IDECompilerMessagingTest.java
...jet/plugin/compilerMessages/IDECompilerMessagingTest.java
+4
-35
idea/tests/org/jetbrains/jet/plugin/compilerMessages/JetCompilerMessagingTest.java
...jet/plugin/compilerMessages/JetCompilerMessagingTest.java
+69
-0
未找到文件。
idea/tests/org/jetbrains/jet/plugin/compilerMessages/IDECompilerMessagingTest.java
浏览文件 @
7ba22df3
...
...
@@ -16,6 +16,7 @@
package
org.jetbrains.jet.plugin.compilerMessages
;
import
com.intellij.openapi.compiler.TranslatingCompiler
;
import
com.intellij.openapi.vfs.LocalFileSystem
;
import
com.intellij.openapi.vfs.VirtualFile
;
import
com.intellij.testFramework.PlatformTestCase
;
...
...
@@ -32,44 +33,12 @@ import static org.jetbrains.jet.plugin.compilerMessages.Message.warning;
/**
* @author Pavel Talanov
*/
public
final
class
IDECompilerMessagingTest
extends
PlatformTestCase
{
public
abstract
class
IDECompilerMessagingTest
extends
PlatformTestCase
{
private
static
final
String
TEST_DATA_PATH
=
PluginTestCaseBase
.
getTestDataPathBase
()
+
"/compilerMessages"
;
public
void
testHelloWorld
()
{
doTest
(
new
Function1
<
MessageChecker
,
Void
>()
{
@Override
public
Void
invoke
(
MessageChecker
checker
)
{
//nothing apart from header
return
null
;
}
});
}
public
void
testSimpleWarning
()
{
doTest
(
new
Function1
<
MessageChecker
,
Void
>()
{
@Override
public
Void
invoke
(
MessageChecker
checker
)
{
checker
.
expect
(
warning
().
text
(
"Unnecessary non-null assertion (!!) on a non-null receiver of type jet.String"
)
.
at
(
"test.kt"
,
4
,
4
));
return
null
;
}
});
}
public
void
testSimpleError
()
{
doTest
(
new
Function1
<
MessageChecker
,
Void
>()
{
@Override
public
Void
invoke
(
MessageChecker
checker
)
{
checker
.
expect
(
error
().
text
(
"A 'return' expression required in a function with a block body ('{...}')"
).
at
(
"test.kt"
,
5
,
1
));
return
null
;
}
});
}
pr
ivate
void
doTest
(
@NotNull
Function1
<
MessageChecker
,
Void
>
whatToExpect
)
{
pr
otected
void
performTest
(
Function1
<
MessageChecker
,
Void
>
whatToExpect
,
@NotNull
TranslatingCompiler
compiler
)
{
String
pathToTestDir
=
TEST_DATA_PATH
+
"/"
+
getTestName
(
true
);
VirtualFile
testDir
=
LocalFileSystem
.
getInstance
().
findFileByPath
(
pathToTestDir
);
VirtualFile
sampleFile
=
LocalFileSystem
.
getInstance
().
findFileByPath
(
pathToTestDir
+
"/src/test.kt"
);
...
...
@@ -77,7 +46,7 @@ public final class IDECompilerMessagingTest extends PlatformTestCase {
VirtualFile
root
=
LocalFileSystem
.
getInstance
().
findFileByPath
(
pathToTestDir
+
"/src/"
);
MockCompileContext
mockCompileContext
=
new
MockCompileContext
(
myModule
,
outDirectory
,
root
);
MockModuleChunk
mockModuleChunk
=
new
MockModuleChunk
(
myModule
);
new
JetCompiler
()
compiler
.
compile
(
mockCompileContext
,
mockModuleChunk
,
new
VirtualFile
[]
{
sampleFile
},
new
MockOutputSink
());
MessageChecker
checker
=
new
MessageChecker
(
mockCompileContext
);
checkHeader
(
checker
);
...
...
idea/tests/org/jetbrains/jet/plugin/compilerMessages/JetCompilerMessagingTest.java
0 → 100644
浏览文件 @
7ba22df3
/*
* Copyright 2010-2012 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.jetbrains.jet.plugin.compilerMessages
;
import
jet.Function1
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.jet.plugin.compiler.JetCompiler
;
import
static
org
.
jetbrains
.
jet
.
plugin
.
compilerMessages
.
Message
.
error
;
import
static
org
.
jetbrains
.
jet
.
plugin
.
compilerMessages
.
Message
.
warning
;
/**
* @author Pavel Talanov
*/
public
final
class
JetCompilerMessagingTest
extends
IDECompilerMessagingTest
{
public
void
testHelloWorld
()
{
doTest
(
new
Function1
<
MessageChecker
,
Void
>()
{
@Override
public
Void
invoke
(
MessageChecker
checker
)
{
//nothing apart from header
return
null
;
}
});
}
public
void
testSimpleWarning
()
{
doTest
(
new
Function1
<
MessageChecker
,
Void
>()
{
@Override
public
Void
invoke
(
MessageChecker
checker
)
{
checker
.
expect
(
warning
().
text
(
"Unnecessary non-null assertion (!!) on a non-null receiver of type jet.String"
)
.
at
(
"test.kt"
,
4
,
4
));
return
null
;
}
});
}
public
void
testSimpleError
()
{
doTest
(
new
Function1
<
MessageChecker
,
Void
>()
{
@Override
public
Void
invoke
(
MessageChecker
checker
)
{
checker
.
expect
(
error
().
text
(
"A 'return' expression required in a function with a block body ('{...}')"
).
at
(
"test.kt"
,
5
,
1
));
return
null
;
}
});
}
private
void
doTest
(
@NotNull
Function1
<
MessageChecker
,
Void
>
whatToExpect
)
{
JetCompiler
compiler
=
new
JetCompiler
();
performTest
(
whatToExpect
,
compiler
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录