1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.github.maven_nar.cpptasks.compiler;
21
22 import java.io.File;
23
24 import com.github.maven_nar.cpptasks.ProcessorParam;
25 import com.github.maven_nar.cpptasks.gcc.GccCCompiler;
26
27
28
29 public class TestCommandLineCompilerConfiguration extends TestCompilerConfiguration {
30 private final CommandLineCompiler compiler;
31 private final String compilerId;
32
33 public TestCommandLineCompilerConfiguration(final String name) {
34 super(name);
35 this.compiler = GccCCompiler.getInstance();
36 this.compilerId = this.compiler.getIdentifier();
37 }
38
39 @Override
40 protected CompilerConfiguration create() {
41 return new CommandLineCompilerConfiguration(this.compiler, "dummy", new File[0], new File[0], new File[0], "",
42 new String[] {
43 "/Id:/gcc"
44 }, new ProcessorParam[0], false, new String[0]);
45 }
46
47 public void testConstructorNullCompiler() {
48 try {
49 new CommandLineCompilerConfiguration(null, "dummy", new File[0], new File[0], new File[0], "", new String[0],
50 new ProcessorParam[0], false, new String[0]);
51 fail("Should throw exception for null compiler");
52 } catch (final NullPointerException ex) {
53 }
54 }
55
56 public void testGetIdentifier() {
57 final CompilerConfiguration config = create();
58 final String id = config.getIdentifier();
59 assertEquals("dummy", id);
60 }
61
62 public void testToString() {
63 final CompilerConfiguration config = create();
64 final String toString = config.toString();
65 assertEquals("dummy", toString);
66 }
67 }