Skip to content
Snippets Groups Projects
Select Git revision
  • f2d9f3e2fa1610e21e19c7d91e365f3ec78bf5a7
  • master default protected
  • rednatco-v2
  • rednatco
  • test
  • ntc-tube-uniform-color
  • ntc-tube-missing-atoms
  • restore-vertex-array-per-program
  • watlas2
  • dnatco_new
  • cleanup-old-nodejs
  • webmmb
  • fix_auth_seq_id
  • update_deps
  • ext_dev
  • ntc_balls
  • nci-2
  • plugin
  • bugfix-0.4.5
  • nci
  • servers
  • v0.5.0-dev.1
  • v0.4.5
  • v0.4.4
  • v0.4.3
  • v0.4.2
  • v0.4.1
  • v0.4.0
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • v0.3.3
  • v0.3.2
  • v0.3.1
  • v0.3.0
41 results

compiler.ts

Blame
  • location_test.dart 2.54 KiB
    import 'dart:io';
    
    import 'package:scp_meta/location.dart';
    import 'package:test/test.dart';
    
    void main() {
      group('SCP simple as [user@]host:[path]', () {
        test('SCP as user@host:path', () {
          Location location = Location('username@plzen1:etc/file.txt');
          expect(location.path, 'etc/file.txt');
          expect(location.user, 'username');
          expect(location.host, 'plzen1');
        });
    
        test('SCP as host:file', () {
          Location location = Location(
              'storage-plzen1.metacentrum.cz:etc/file.txt');
          expect(location.path, 'etc/file.txt');
          expect(location.user, null);
          expect(location.host, 'storage-plzen1.metacentrum.cz');
        });
    
        test('SCP as host:', () {
          Location location = Location('brno6.metacentrum.cz:');
          expect(location.path, null);
          expect(location.user, null);
          expect(location.host, 'brno6.metacentrum.cz');
        });
      });
    
      group('SCP URI as scp://[user@]host[:port][/path]', () {
        test('scp://user@host:port/path', () {
          Location location = Location('scp://_user-2@praha1:2222/tmp');
          expect(location.user, '_user-2');
          expect(location.host, 'praha1');
          expect(location.path, '/tmp');
          expect(location.port, '2222');
        });
    
        test('scp://user@host', () {
          Location location = Location('scp://123456@storage-brno2');
          expect(location.user, '123456');
          expect(location.host, 'storage-brno2');
          expect(location.path, null);
          expect(location.port, null);
        });
    
        test('scp://host', () {
          Location location = Location('scp://pruhonice1');
          expect(location.user, null);
          expect(location.host, 'pruhonice1');
          expect(location.path, null);
          expect(location.port, null);
        });
      });
    
      group('PATH', ()
      {
        test('absolute path as /.*', () {
          Location location = Location('/home/test/_list/.config');
          expect(location.user, null);
          expect(location.host, null);
          expect(location.path, '/home/test/_list/.config');
          expect(location.port, null);
        });
    
        test('relative path as .*', () {
          Location location = Location('../test/_file');
          expect(location.user, null);
          expect(location.host, null);