Skip to content

  • 项目
  • 群组
  • 代码片段
  • 帮助
  • 当前项目
    • 正在载入...
  • 登录 / 注册
G
go-ipfs
  • 概览
    • 概览
    • 详情
    • 活动
    • 周期分析
  • 版本库
    • 仓库
    • 文件
    • 提交
    • 分支
    • 标签
    • 贡献者
    • 分支图
    • 比较
    • 统计图
  • 问题 0
    • 议题 0
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 0
    • 合并请求 0
  • CI / CD
    • CI / CD
    • 流水线
    • 作业
    • 日程表
    • 图表
  • 维基
    • Wiki
  • 代码片段
    • 代码片段
  • 成员
    • 成员
  • 折叠边栏
  • 活动
  • 图像
  • 聊天
  • 创建新问题
  • 作业
  • 提交
  • 问题看板
  • jihao
  • go-ipfs
  • Repository

切换分支/标签
  • go-ipfs
  • test
  • ipfs-test-lib.sh
查找文件
BlameHistoryPermalink
  • Christian Couder's avatar
    ipfs-test-lib: fix test_fsh arg quoting · 2489dfe8
    test_fsh() should quote its arguments before passing them
    to `eval` otherwise there are problems when the arguments
    contain spaces.
    
    For example when running the following program:
    
    ```
    #!/bin/sh
    
    . ./ipfs-test-lib.sh
    
    die () {
        printf >&2 "%s\n" "$@"
        exit 1
    }
    
    DIR1="test dir 1"
    DIR2="test dir 2"
    
    mkdir "$DIR1" "$DIR2" || die "Could not mkdir '$DIR1' '$DIR2'"
    
    echo "in dir 1" >"$DIR1/file1" || die "Could not write into '$DIR1/file1'"
    echo "in dir 2" >"$DIR2/file2" || die "Could not write into '$DIR2/file2'"
    
    if test_cmp "$DIR1/file1" "$DIR2/file2"
    then
        echo "test_cmp succeeded!"
    else
        echo "test_cmp failed!"
    fi
    
    rm -rf "$DIR1" "$DIR2" || die "Could not rm -rf '$DIR1' '$DIR2'"
    
    ```
    
    we get:
    
    ```
    > diff -u test dir 1/file1 test dir 2/file2
    diff: extra operand '1/file1'
    diff: Try 'diff --help' for more information.
    
    test_cmp failed!
    ```
    
    License: MIT
    Signed-off-by: 's avatarChristian Couder <chriscool@tuxfamily.org>
    由 Christian Couder 提交于 8月 15, 2016
    2489dfe8
ipfs-test-lib.sh 2.4 KB
编辑Web IDE
×

Replace ipfs-test-lib.sh

拖放文件到此处或者 点击上传


取消
将在派生(fork)项目中中创建一个新的分支, 并开启一个新的合并请求。