|
31 | 31 | package test
|
32 | 32 |
|
33 | 33 | import (
|
34 |
| - "github.com/arduino/arduino-builder" |
35 |
| - "github.com/arduino/arduino-builder/types" |
36 |
| - "github.com/arduino/arduino-builder/utils" |
37 |
| - "github.com/stretchr/testify/require" |
38 | 34 | "os"
|
39 | 35 | "path/filepath"
|
40 | 36 | "strings"
|
41 | 37 | "testing"
|
| 38 | + |
| 39 | + "github.com/arduino/arduino-builder" |
| 40 | + "github.com/arduino/arduino-builder/types" |
| 41 | + "github.com/arduino/arduino-builder/utils" |
| 42 | + "github.com/stretchr/testify/require" |
42 | 43 | )
|
43 | 44 |
|
44 | 45 | func TestPrototypesAdderBridgeExample(t *testing.T) {
|
@@ -906,3 +907,45 @@ func TestPrototypesAdderSketchWithDosEol(t *testing.T) {
|
906 | 907 | }
|
907 | 908 | // only requires no error as result
|
908 | 909 | }
|
| 910 | + |
| 911 | +func TestPrototypesAdderSketchWithSubstringFunctionMember(t *testing.T) { |
| 912 | + DownloadCoresAndToolsAndLibraries(t) |
| 913 | + |
| 914 | + sketchLocation := filepath.Join("sketch_with_class_and_method_substring", "sketch_with_class_and_method_substring.ino") |
| 915 | + quotedSketchLocation := utils.QuoteCppString(Abs(t, sketchLocation)) |
| 916 | + |
| 917 | + ctx := &types.Context{ |
| 918 | + HardwareFolders: []string{filepath.Join("..", "hardware"), "hardware", "downloaded_hardware"}, |
| 919 | + ToolsFolders: []string{"downloaded_tools"}, |
| 920 | + BuiltInLibrariesFolders: []string{"downloaded_libraries"}, |
| 921 | + OtherLibrariesFolders: []string{"libraries"}, |
| 922 | + SketchLocation: sketchLocation, |
| 923 | + FQBN: "arduino:avr:uno", |
| 924 | + ArduinoAPIVersion: "10600", |
| 925 | + Verbose: true, |
| 926 | + } |
| 927 | + |
| 928 | + buildPath := SetupBuildPath(t, ctx) |
| 929 | + defer os.RemoveAll(buildPath) |
| 930 | + |
| 931 | + commands := []types.Command{ |
| 932 | + |
| 933 | + &builder.ContainerSetupHardwareToolsLibsSketchAndProps{}, |
| 934 | + |
| 935 | + &builder.ContainerMergeCopySketchFiles{}, |
| 936 | + |
| 937 | + &builder.ContainerFindIncludes{}, |
| 938 | + |
| 939 | + &builder.PrintUsedLibrariesIfVerbose{}, |
| 940 | + &builder.WarnAboutArchIncompatibleLibraries{}, |
| 941 | + |
| 942 | + &builder.ContainerAddPrototypes{}, |
| 943 | + } |
| 944 | + |
| 945 | + for _, command := range commands { |
| 946 | + err := command.Run(ctx) |
| 947 | + NoError(t, err) |
| 948 | + } |
| 949 | + |
| 950 | + require.Contains(t, ctx.Source, "class Foo {\nint blooper(int x) { return x+1; }\n};\n\nFoo foo;\n\n#line 7 "+quotedSketchLocation+"\nvoid setup();") |
| 951 | +} |
0 commit comments