Unverified Commit d94fe6c2 authored by Cristian Maglie's avatar Cristian Maglie Committed by GitHub

Removed functions for command line mangling (#400)

parent 94e7e7aa
......@@ -34,8 +34,6 @@ import (
"os"
"path/filepath"
"sort"
"strconv"
"strings"
)
func Walk(root string, walkFn filepath.WalkFunc) error {
......@@ -127,19 +125,3 @@ func resolveSymlink(parentFolder string, info os.FileInfo) (os.FileInfo, error)
func isSymlink(info os.FileInfo) bool {
return info.Mode()&os.ModeSymlink != 0
}
func Unquote(s string) (string, error) {
if stringStartsEndsWith(s, "'") {
s = s[1 : len(s)-1]
}
if !stringStartsEndsWith(s, "\"") {
return s, nil
}
return strconv.Unquote(s)
}
func stringStartsEndsWith(s string, c string) bool {
return strings.HasPrefix(s, c) && strings.HasSuffix(s, c)
}
/*
* This file is part of Arduino Builder.
*
* Arduino Builder is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* As a special exception, you may use this file as part of a free software
* library without restriction. Specifically, if other files instantiate
* templates or use macros or inline functions from this file, or you compile
* this file and link it with other files to produce an executable, this
* file does not by itself cause the resulting executable to be covered by
* the GNU General Public License. This exception does not however
* invalidate any other reasons why the executable file might be covered by
* the GNU General Public License.
*
* Copyright 2015 Arduino LLC (http://www.arduino.cc/)
*/
package test
import (
"github.com/arduino/arduino-cli/legacy/builder/gohasissues"
"github.com/stretchr/testify/require"
"testing"
)
func TestStrConvUnquote(t *testing.T) {
s, err := gohasissues.Unquote("ciao")
NoError(t, err)
require.Equal(t, "ciao", s)
s, err = gohasissues.Unquote("arduino:avr:uno")
NoError(t, err)
require.Equal(t, "arduino:avr:uno", s)
s, err = gohasissues.Unquote("\"arduino:avr:uno\"")
NoError(t, err)
require.Equal(t, "arduino:avr:uno", s)
s, err = gohasissues.Unquote("'arduino:avr:uno'")
NoError(t, err)
require.Equal(t, "arduino:avr:uno", s)
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment