# Native syntax error on testSuites definition

**URL:** <https://discuss.gradle.org/t/native-syntax-error-on-testsuites-definition/19789>\
**Category:** Bugs\
**Tags:** issue-acknowledged, gradle-3570\
**Created:** [September 29, 2016, 9:02am UTC](https://discuss.gradle.org/t/native-syntax-error-on-testsuites-definition/19789 "2016-09-29T09:02:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zosrothko](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/zosrothko/32/5438_2.png) [@zosrothko](https://discuss.gradle.org/u/zosrothko)\
**Post date:** [September 29, 2016, 9:02am UTC](https://discuss.gradle.org/t/native-syntax-error-on-testsuites-definition/19789/1 "2016-09-29T09:02:43Z")

</div>

Hi

I got a syntax error on the following snippet

```gradle
        testSuites {
            PocoFoundationTest(CUnitTestSuiteSpec) {
                testing $.components.PocoFoundation
            }
        }

```

```gradle
build file 'build.gradle': 69: Invalid variable name. Must include a letter but only found: $
. At [69:13] @ line 69, column 13.
                                testing $.components.PocoFoundation

```

What should be the correct syntax?

TFYH

---

<div class="post-metadata">

**Author:** ![eskatos](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/eskatos/32/5401_2.png) [@eskatos](https://discuss.gradle.org/u/eskatos)\
**Post date:** [September 29, 2016, 9:08am UTC](https://discuss.gradle.org/t/native-syntax-error-on-testsuites-definition/19789/2 "2016-09-29T09:08:32Z")

</div>

Syntax looks good. It is on par with the manual, see [https://docs.gradle.org/current/userguide/native\_software.html#sec:running\_cunit\_tests](https://docs.gradle.org/current/userguide/native_software.html#sec:running_cunit_tests)  
Hard to tell what’s the issue without a more complete build script.  
Is your snippet inside a `model` block?

---

<div class="post-metadata">

**Author:** ![zosrothko](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/zosrothko/32/5438_2.png) [@zosrothko](https://discuss.gradle.org/u/zosrothko)\
**Post date:** [September 29, 2016, 9:29am UTC](https://discuss.gradle.org/t/native-syntax-error-on-testsuites-definition/19789/3 "2016-09-29T09:29:36Z")

</div>

> Is your snippet inside a model block?  
> Yes… Here the full build.gradle

```gradle
project(":Foundation") {
    model {
        def os = org.gradle.internal.os.OperatingSystem.current()
        components {
            PocoFoundation(NativeLibrarySpec) {
                sources {
                    mc {
                        source {
                            srcDir 'src'
                            include '**/*.mc'
                        }
                    }
                    rc {
                        source {
                            srcDir 'src'
                            include '**/*.rc'
                        }
                    }
                    c {
                        source {
                            srcDir 'src'
                            include '**/*.c'
                        }
                        exportedHeaders {
                            srcDir 'include'
                        }
                    }
                    cpp {
                        source {
                            srcDir 'src'
                            include '**/*.cpp'
                            exclude 'ByteOrder.cpp'
                            exclude 'String.cpp'
                            exclude 'SignalHandler.cpp'
                            exclude 'Environment_*.cpp'
                            exclude 'FPEnvironment_*.cpp'
                            exclude 'Timezone_*.cpp'
                            exclude 'DirectoryIterator_*.cpp'
                            exclude 'File_*.cpp'
                            exclude 'FileStream_*.cpp'
                            exclude 'Path_*.cpp'
                            exclude 'LogFile_*.cpp'
                            exclude 'NamedEvent_*.cpp'
                            exclude 'NamedMutex_*.cpp'
                            exclude 'PipeImpl_*.cpp'
                            exclude 'Process_*.cpp'
                            exclude 'SharedMemory_*.cpp'
                            exclude 'SharedLibrary_*.cpp'
                            exclude 'Event_*.cpp'
                            exclude 'Mutex_*.cpp'
                            exclude 'RWLock_*.cpp'
                            exclude 'Semaphore_*.cpp'
                            exclude 'Thread_*.cpp'
                            if (os.isWindows()) {
                                exclude 'SyslogChannel.cpp'
                                exclude 'OpcomChannel.cpp'
                                exclude 'AndroidLogChannel.cpp'
                            }
                        }
                        exportedHeaders {
                            srcDir 'include'
                        }
                    }
                }
            }
        }
        testSuites {
            PocoFoundationTest(CUnitTestSuiteSpec) {
                testing $.components.PocoFoundation
            }
        }
        binaries {
            all {
                if (toolChain in VisualCpp) {
                    linker.args 'ws2_32.lib'
                    linker.args 'iphlpapi.lib'
                }
            }
            withType(SharedLibraryBinarySpec) {
                if (toolChain in VisualCpp) {
                    cCompiler.define "Foundation_EXPORTS"
                    cppCompiler.define "Foundation_EXPORTS"
                }
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![davidfa](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@davidfa](https://discuss.gradle.org/u/davidfa)\
**Post date:** [September 29, 2016, 9:59am UTC](https://discuss.gradle.org/t/native-syntax-error-on-testsuites-definition/19789/4 "2016-09-29T09:59:46Z")

</div>

Looks identical to the issue I questioned yesterday ( [forum link](https://discuss.gradle.org/t/syntax-within-project-scope/19771) )

I think the issue is that it’s within the project scope ( the $. syntax ) - I just don’t know whether it’s an actual issue or why.

I bet if you move the model {} to an external script, then apply from: ‘external-script’ within the project it all magically works.

Sorry to not be of more help.

---

<div class="post-metadata">

**Author:** ![zosrothko](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/zosrothko/32/5438_2.png) [@zosrothko](https://discuss.gradle.org/u/zosrothko)\
**Post date:** [September 29, 2016, 12:17pm UTC](https://discuss.gradle.org/t/native-syntax-error-on-testsuites-definition/19789/5 "2016-09-29T12:17:56Z")

</div>

Putting the model in an external script solves the issue…; May be you can open a bug on this point?

---

<div class="post-metadata">

**Author:** ![davidfa](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@davidfa](https://discuss.gradle.org/u/davidfa)\
**Post date:** [September 29, 2016, 12:31pm UTC](https://discuss.gradle.org/t/native-syntax-error-on-testsuites-definition/19789/6 "2016-09-29T12:31:15Z")

</div>

One of the core devs kindly already did - [GRADLE-3570](https://issues.gradle.org/browse/GRADLE-3570)

See the other thread I’d mentioned.
