Testing framework bug (configureFromFileText("a.c", ""))

=======================================================

=======================================================

=======================================================

2 comments

Missing assertion actually. Read this as following: "Can't create PsiFile
for 'a.c'. Unknown file type most probably.".

Fixed.

--

Best regards,
Maxim Shafirov
JetBrains, Inc / IntelliJ Software
http://www.intellij.com
"Develop with pleasure!"


"Timur Zambalayev" <no_mail@jetbrains.com> wrote in message
news:1608325.1062032984034.JavaMail.itn@is.intellij.net...

=======================================================

 import java.io.IOException;
>
> import com.intellij.testFramework.LightCodeInsightTestCase;
>
> public final class Test extends LightCodeInsightTestCase {
>
>     public void test() throws IOException {
>         configureFromFileText("a.c", "");
>     }
>
> }
> ]]>

=======================================================
[junit] Testcase: test took 3.375 sec > [junit] Caused an ERROR > [junit] null > [junit] java.lang.ClassCastException > [junit] at com.intellij.testFramework.LightCodeInsightTestCase.a(LightCodeInsightTestCa se.java:38) > [junit] at com.intellij.testFramework.LightCodeInsightTestCase.configureFromFileText(Li ghtCodeInsightTestCase.java:80) > [junit] at Test.test(Test.java:9) > [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) > [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) > [junit] at com.intellij.testFramework.LightCodeInsightTestCase.a(LightCodeInsightTestCa se.java:118) > [junit] at com.intellij.testFramework.LightCodeInsightTestCase$2.run(LightCodeInsightTe stCase.java:3) > [junit] at com.intellij.openapi.command.a.b.executeCommand(b.java:78) > [junit] at com.intellij.testFramework.LightCodeInsightTestCase$1.run(LightCodeInsightTe stCase.java:4) > [junit] at com.intellij.openapi.application.a.d.runWriteAction(d.java:159) > [junit] at com.intellij.testFramework.LightCodeInsightTestCase.runTest(LightCodeInsight TestCase.java:57) > [junit] at com.intellij.testFramework.LightIdeaTestCase.d(LightIdeaTestCase.java:27) > [junit] at com.intellij.testFramework.LightIdeaTestCase.a(LightIdeaTestCase.java:38) > [junit] at com.intellij.testFramework.LightIdeaTestCase$4.run(LightIdeaTestCase.java:3) > [junit] at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171) > [junit] at java.awt.EventQueue.dispatchEvent(EventQueue.java:454) > [junit] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.ja va:201) > [junit] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java :151) > [junit] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) > [junit] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) > [junit] at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) > ]]>
=======================================================




0

Missing assertion actually. Read this as following:
"Can't create PsiFile
for 'a.c'. Unknown file type most probably.".


Is it possible to register a file type programatically, maybe just temporarily for the run of the test (I think it's not at the moment)?

This is for CommentPlugin tests. I'm dealing with many different file types there. If it's not possible to register programatically (i.e. automatically by the tests), then the setup to run the tests for the first time will be more complicated since it'll require a big manual step (file type registering).

And how about an option (in the tests of course) to treat unknown file types as plain text?


Timur

0

Please sign in to leave a comment.